php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26335 iptcparse will not read TIFF iptc data
Submitted: 2003-11-20 14:17 UTC Modified: 2003-11-24 02:35 UTC
From: stephane dot rochon at free dot fr Assigned:
Status: Not a bug Package: GetImageSize related
PHP Version: 4.3.3 OS: XP
Private report: No CVE-ID: None
 [2003-11-20 14:17 UTC] stephane dot rochon at free dot fr
Description:
------------
I have to image files. One is a jpeg and one is a tiff. They have the same IPTC data embeded using Fotostation Pro.

When I read the jpeg header, I have all the IPTC information, when I read the tiff header, I get nothing.

That's all !

Cheers,

Stephane

Reproduce code:
---------------
$size = getimagesize ("D:\image.tif",&$info);
if (isset ($info["APP13"])) {
    $iptc = iptcparse ($info["APP13"]);
    var_dump ($iptc);
}

Expected result:
----------------
That's what I get with the JPEG file :

array(6) { ["2#000"]=> array(1) { [0]=> string(2) "" } ["2#120"]=> array(1) { [0]=> string(19) "Christ of the Abyss" } ["2#005"]=> array(1) { [0]=> string(18) "Christ des Abysses" } ["2#025"]=> array(28) { [0]=> string(10) "underwater" [1]=> string(4) "park" [2]=> string(7) "reserve" [3]=> string(5) "glory" [4]=> string(5) "jesus" [5]=> string(5) "power" [6]=> string(4) "soul" [7]=> string(5) "light" [8]=> string(9) "pennekamp" [9]=> string(4) "jhon" [10]=> string(5) "largo" [11]=> string(3) "key" [12]=> string(4) "keys" [13]=> string(7) "florida" [14]=> string(6) "statue" [15]=> string(4) "deep" [16]=> string(5) "water" [17]=> string(5) "angle" [18]=> string(4) "wide" [19]=> string(5) "abyss" [20]=> string(6) "christ" [21]=> string(10) "silhouette" [22]=> string(6) "prayer" [23]=> string(3) "god" [24]=> string(5) "peace" [25]=> string(3) "sun" [26]=> string(5) "faith" [27]=> string(4) "blue" } ["2#231"]=> array(1) { [0]=> string(1280) "X 22/09/2003 13:28:30 Texte enregistr?X 02/10/2003 20:03:12 Texte enregistr?X 08/11/2003 21:16:19 Texte enregistr?X 08/11/2003 23:25:00 Texte enregistr?X 08/11/2003 23:27:11 Texte enregistr?" } ["2#240"]=> array(1) { [0]=> string(2368) "" } 

Actual result:
--------------
That's what I get with the TIFF file :

Notice: Undefined index: APP13 in D:\Web\read_IPTC.php on line 19


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-11-20 19:24 UTC] iliaa@php.net
Please supply the images used in your tests.
 [2003-11-21 03:36 UTC] stephane dot rochon at free dot fr
Hello, thanks for your help !

Here is the code you can test here : http://www.subphoto.com/IPTC/IPTC_lecture.php

with images : 
http://www.subphoto.com/IPTC/dauphin.jpg
http://www.subphoto.com/IPTC/dauphin.tif

There is one caption and three keywords in each image files.

<? 
echo "JPEG file info : ";
print_r(getImageSize('dauphin.jpg')); 
echo "<br>";

echo "TIFF file info : ";
print_r(getImageSize('dauphin.tif')); 
echo "<br>";

echo "IPTC fields for JPEG file :";
$size = getimagesize ("dauphin.jpg",&$info);
if (isset ($info["APP13"])) {
    $iptc = iptcparse ($info["APP13"]);
    var_dump ($iptc);
} 
echo "<br>";

echo "IPTC fields for TIFF file :";
$size = getimagesize ("dauphin.tif",&$info);
if (isset ($info["APP13"])) {
    $iptc = iptcparse ($info["APP13"]);
    var_dump ($iptc);
} 
echo "<br>";
?>
 [2003-11-23 20:23 UTC] iliaa@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

According to image analysis tools I have here the tiff image does not contain any valid IPTC data.
 [2003-11-24 02:35 UTC] stephane dot rochon at free dot fr
Thank you for your replay. I checked again, and yes both files have the same IPTC data. I can read it with softares lake Fotostation Pro, but not with the PHP code.

Cheers,
 [2004-08-04 03:44 UTC] nospam at riecks dot com
TIFF files come in two "flavors" "big-endian, and little-endian." If you are using photoshop then you have the option to save using IBM PC or Macintosh "byte order" settings. This determines whether the "header" of the file is at the beginning of the data, or the end. If the PHP code is looking for this in the head, and it's actually in the tail, that could cause a problem. 

In addition, there can be several locations that Fotostation writes the IPTC metadata, depending on your operating system. If you are on a mac, and using an older version of Fotostation, then it's possible that the IPTC metadata is being written to the "resource fork" of the file, rather than the data fork. If this is the case, then when you upload the raw TIFF file, the resource fork is "stripped" and thus the metadata is gone. 

I downloaded the file and opened in photoshop and could read the file info (it had the word "test" in both the caption and the keyword fields). 

You might try seeing what happens if you open the file (after editing in Fotostation) in Photoshop, and resave the TIF using the two different "byte orders" and see if that makes a difference.

BTW, I moderate a group that deals with metadata issues, and there may be others that have experienced the problems you are finding that are participating. The group is called Controlled Vocabulary and you can sign up at the bottom of the main page at (http://ControlledVocabulary.com/). 

Hope that helps. 

David
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 06:01:30 2024 UTC