Php cargar imagen


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function cargarImagen( $dir, $img, $alt='', $extraDentro='', $extra = '' ){
  2. $imagen = '';
  3. if( isset( $img ) && ! empty( $img ) && file_exists( $dir . $img ) ){
  4. $size = getimagesize( $dir . $img );
  5. $imagen = '<img src="'.$dir.$img.'" width="'.$size[0].'" height="'.$size[1].'" border=0 alt="'. ( empty( $alt ) ? $img : $alt ).'" '.$extraDentro.'>' . $extra;
  6. }
  7. return $imagen;
  8. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.