note 105025 added to function.iptcparse
| From: | www dot peterdebruin dot net at osu1 dot php dot net | Date: | Fri, 22 Jul 2011 20:12:45 +0000 |
| Subject: | note 105025 added to function.iptcparse | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-181795@lists.php.net to get a copy of this message | ||
Nowadays IPTC captions may be encoded in UTF-8.
In that case, IPTC tag CodedCharacterSet would be set to "ESC % G".
This tag has tag marker "1#090".
To decode such a caption into simple ISO-8859-1, you could use the following code:
$IPTC_Caption = "";
$size = getimagesize( $image_path, $info );
if (isset($info["APP13"])) {
if($iptc = iptcparse( $info["APP13"] ) ) {
$IPTC_Caption = str_replace( "\000", "", $iptc["2#120"][0] );
if(isset($iptc["1#090"]) && $iptc["1#090"][0] == "\x1B%G")
$IPTC_Caption = utf8_decode($IPTC_Caption);
}
}
Of course, this will only preserve ISO-8859-1 characters.
For proper Unicode support, you should convert UTF-8 byte sequences into HTML character entities, or
encode the whole web page in UTF-8.
----
Server IP: 69.147.83.197
Probable Submitter: 87.212.135.160
----
Manual Page -- http://www.php.net/manual/en/function.iptcparse.php
Edit -- https://master.php.net/note/edit/105025
Del: integrated -- https://master.php.net/note/delete/105025/integrated
Del: useless -- https://master.php.net/note/delete/105025/useless
Del: bad code -- https://master.php.net/note/delete/105025/bad+code
Del: spam -- https://master.php.net/note/delete/105025/spam
Del: non-english -- https://master.php.net/note/delete/105025/non-english
Del: in docs -- https://master.php.net/note/delete/105025/in+docs
Del: other reasons-- https://master.php.net/note/delete/105025
Reject -- https://master.php.net/note/reject/105025
Search -- https://master.php.net/manage/user-notes.php