Posted By

jamesming on 07/26/08


Tagged

width image size height


Versions (?)

Who likes this?

5 people have marked this snippet as a favorite

vali29
riddla
adiian
astroneo
Priestd09


Get the width and height of an image using a function in PHP


 / Published in: PHP
 

URL: http://www.phpeasystep.com/workshopview.php?id=25

When you run this script you will see the result like this

Image width 379 Image height 344 Image type 2 Image attribute width="379" height="344"

You will get the width, height, type of an image and also attribute of an image, I use this function in my image upload form.

  1. <?php
  2.  
  3. list($width, $height, $type, $attr) = getimagesize("image_name.jpg");
  4.  
  5. echo "Image width " .$width;
  6. echo "<BR>";
  7. echo "Image height " .$height;
  8. echo "<BR>";
  9. echo "Image type " .$type;
  10. echo "<BR>";
  11. echo "Attribute " .$attr;
  12.  
  13. ?>

Report this snippet  

You need to login to post a comment.