note 44545 added to function.getimagesize

From: Date: Mon, 09 Aug 2004 16:10:08 +0000
Subject: note 44545 added to function.getimagesize
Groups: php.notes 
Request: Send a blank email to php-notes+get-74327@lists.php.net to get a copy of this message
The getimagesize function has a design flaw when used with JPEG images. The imageinfo array it returns is indexed by the names of the APP segments. JPEG files allow (and often have) multiple APP segments of the same type, hence they should not be indexed by the name of the APP segment as this is not unique. I have written a JPEG metadata library for PHP which includes a function "get_jpeg_header_data" which solves this problem. See http://www.ozhiker.com/electronics/pjmt/index.html As an example, A file I tested has the following segments: APP0 JFIF APP1 Exif APP13 Photoshop IRB APP1 XAP/RDF APP2 ICC_PROFILE APP14 Adobe This is the imageinfo output from the getimagesize - Notice that the second APP1 segment is missing: array(5) { ["APP0"]=> string(14) "JFIF...... ["APP1"]=> string(4908) "Exif..MM........ ["APP13"]=> string(5762) "Photoshop 3.0.8BIM...... ["APP2"]=> string(3158) "ICC_PROFILE..... ["APP14"]=> string(31) "Adobe...... } ---- Manual Page -- http://www.php.net/manual/en/function.getimagesize.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+44545 Delete -- http://master.php.net/manage/user-notes.php?action=delete+44545&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+44545&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#74327) next »