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!
"";
echo "Image height " .$height;
echo "
";
echo "Image type " .$type;
echo "
";
echo "Attribute " .$attr;
?>
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
Labels:
Tutorials
Get Width and Height of an Image in PHP
Rama
Saturday, April 2, 2011
Subscribe to:
Post Comments (Atom)
Popular Posts
-
For the recent music video for hip dubstep-rock act Nero’s first chart hit, Me & You, James May – aka Smudgethis – created a fictional ...
-
Today in this tutorial we are going to teach you that how to apply conditional styling in Internet Explorer and what are some reasons to use...
-
Ari Saputra - detikNews Jakarta - Seni mural atau lukisan di dinding jalanan semakin marak di Jakarta. Kebanyakan menghiasi pilar beton j...
-
If like me, you find yourself juggling multiple messenger applications to keep your friends, family and colleagues happy you will be glad to...
-
Dalam bekerja dengan judul game lucu di internet, karakteristik akan hampir selalu menjadi pertimbangan para gamer tentang atas '. Merek...
-
For women, shaping the muscles of the thighs is an important fitness goal. A shapely lower body is considered very feminine, and the right p...
-
Jika Anda seorang pemilik bisnis online Anda mungkin memahami bahwa kemampuan Anda untuk menyampaikan informasi kepada prospek Anda dan pela...
-
The Android phones, which, let's face it, comprise a growing number of phones is emerging as a serious contender in the battle to conf...
-
by: SINGER. Cloud computing can be defined as a data service, software and storage service, where the end user is not aware of the physical ...
-
Long-lasting traditions from some cultures span generations. Perhaps others are shorter lived, but either way there is value to staying conn...
0 comments:
Post a Comment