Advertisement
kremisoski

Image Placeholder Function

Jun 30th, 2013
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.31 KB | None | 0 0
  1. function ph_img($width, $height = NULL) {
  2.     $url = 'http://placehold.it/';
  3.         if($height == NULL) {
  4.             return $url . $width;
  5.         }
  6.     return $url . $width . 'X' . $height;
  7. }
  8.  
  9. /*
  10.  
  11. PLACEHOLDER USAGE:
  12. <img src="<?=ph_img(250);?>"/> //square image 250x250
  13. <img src="<?=ph_img(250,150);?>"/> //image 250x150
  14.  
  15. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement