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
-
Cost-Benefit Analysis of Cloud Computing versus Desktop Grids Derrick Kondo1, Bahman Javadi1, Paul Malecot1, Franck Cappello1, David P. Ander...
-
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...
-
If like me, you find yourself juggling multiple messenger applications to keep your friends, family and colleagues happy you will be glad to...
-
For the recent music video for hip dubstep-rock act Nero’s first chart hit, Me & You, James May – aka Smudgethis – created a fictional ...
-
Girls’ Generation (Korean: Hangul – 소녀시대; Hanja - 少女時代) is a popular nine-member South Korean girl group formed by SM Entertainment in 200...
-
When considering the profound artistic explication of nature in Eastern tea ware and interrelated literati drinking vessels, one can find m...
-
6 years ago I was exactly like you: I was reading a lot about technical analysis and was utterly fascinated about it. The idea of making mon...
-
The Java Tutorials are practical guides for programmers who want to use the Java programming language to create applications. They include h...
-
We live in the future and there are new devices, smart gadgets and computers, almost every day of our lives. It can be quite difficult to ...
-
You may quietly use your computer and surf in the Internet and do not suspect that at the same time somebody may steal your identities and m...
0 comments:
Post a Comment