note 44545 rejected from function.getimagesize by betz

From: Date: Wed, 20 Oct 2004 14:04:22 +0000
Subject: note 44545 rejected from function.getimagesize by betz
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-78829@lists.php.net to get a copy of this message
Note Submitter: evan at nospam dot ozhiker dot com ---- 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...... }

« previous php.notes (#78829) next »