Revision: 59820
Updated Code
at October 3, 2012 12:56 by Some0ne
Updated Code
list($width, $height, $type, $attr) = getimagesize('image_name.jpg'); /* 1 = GIF 5 = PSD 9 = JPC 13 = SWC 2 = JPG 6 = BMP 10 = JP2 14 = IFF 3 = PNG 7 = TIFF(intel byte order) 11 = JPX 15 = WBMP 4 = SWF 8 = TIFF(motorola byte order) 12 = JB2 16 = XBM */ switch($type) { case 1: $typex = 'GIF'; break; case 2: $typex = 'JPG'; break; case 3: $typex = 'PNG'; break; case 4: $typex = 'SWF'; break; case 5: $typex = 'PSD'; break; case 6: $typex = 'BMP'; break; case 7: $typex = 'TIFF(intel byte order)'; break; case 8: $typex = 'TIFF(motorola byte order)'; break; case 9: $typex = 'JPC'; break; case 10: $typex = 'JP2'; break; case 11: $typex = 'JPX'; break; case 12: $typex = 'JB2'; break; case 13: $typex = 'SWC'; break; case 14: $typex = 'IFF'; break; case 15: $typex = 'WBMP'; break; case 16: $typex = 'XBM'; break; } echo 'Width: ' . $width . '<br />Height: ' . $height . '<br />Type: ' . $typex . '<br />Attribute: ' . $attr;
Revision: 59819
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at October 3, 2012 12:53 by Some0ne
Initial Code
list($width, $height, $type, $attr) = getimagesize('image_name.jpg'); /* 1 = GIF 5 = PSD 9 = JPC 13 = SWC 2 = JPG 6 = BMP 10 = JP2 14 = IFF 3 = PNG 7 = TIFF(intel byte order) 11 = JPX 15 = WBMP 4 = SWF 8 = TIFF(motorola byte order) 12 = JB2 16 = XBM */ switch($type) { case 1: $typex = 'GIF'; break; case 2: $typex = 'JPG'; break; case 3: $typex = 'PNG'; break; case 4: $typex = 'SWF'; break; case 5: $typex = 'PSD'; break; case 6: $typex = 'BMP'; break; case 7: $typex = 'TIFF(intel byte order)'; break; case 8: $typex = 'TIFF(motorola byte order)'; break; case 9: $typex = 'JPC'; break; case 10: $typex = 'JP2'; break; case 11: $typex = 'JPX'; break; case 12: $typex = 'JB2'; break; case 13: $typex = 'SWC'; break; case 14: $typex = 'IFF'; break; case 15: $typex = 'WBMP'; break; case 16: $typex = 'XBM'; break; } echo 'Width: ' . $width . '<br />Height: ' . $height . '<br />Type: ' . $typex . '<br />Attribute: ' . $attr;
Initial URL
Initial Description
Just a rework of http://snipplr.com/view/7523/ with an added switch to change type number to extention name.
Initial Title
Get the width, height, type and attr of an image
Initial Tags
image
Initial Language
PHP