iptcparse 


IPTC apg

PARSE a binary IPTC block into single tags.





This function returns an array using the tagmarker as an index and the value as the value.

It returns FALSE on error or if no IPTC data was found.

This function must be used in association with getimagesize.



<?php

array|false iptcparse string $iptc_block )

where,

$iptc_block A binary IPTC block

?>

  $iptc_block   


A binary IPTC block.



  1 EXERCISE   

<?php

$img_file 
"img/hubble.jpg";

$img_info getimagesize($img_file$file_info);
echo 
basename($img_file) . 
'<br><br><img src="' $img_file '" alt="' 
$img_file '" title="' $img_file 
'" width="90%"><br><br>';
 
/*
       echo "<pre>";
       var_dump ( $file_info );
       echo "</pre>";
 */ 
 
 
echo "<br>- - - -<br>";
 
 
$iptc_block0 iptcparse($file_info["APP0"]);
 
 echo 
'<pre style="color:#0000ff;">';
 
var_dump $iptc_block0 );
 echo 
"</pre>- - - -<br>";
 
 
 
$iptc_block1 iptcparse($file_info["APP1"]);
 
 echo 
'<pre style="color:#0000ff;">';
 
var_dump $iptc_block1 );
 echo 
"</pre>- - - -<br>";
 
 
 
$iptc_block13 iptcparse($file_info["APP13"]);
 
 echo 
'<pre style="color:#0000ff;">';
 
var_dump $iptc_block13 );
 echo 
"</pre>- - - -<br>";

?>

 RESULT   

EXISTING IMAGE

hubble.jpg

hubble.jpg apr

- - - -
bool(false)
- - - -
bool(false)
- - - -
array(2) {
["2#000"]=>
array(1) {
[0]=>
string(2) ""
}
["2#005"]=>
array(1) {
[0]=>
string(7) "8x10.ai"
}
}


  2 EXERCISE   

<?php

$img_file 
"img/x0006100.jpg";

$img_info getimagesize($img_file$file_info);

echo 
basename($img_file) . '<br><br>
<img src="' 
$img_file '" alt="' 
$img_file  '" title="' $img_file 
'" width="90%"><br><br>';

echo ( 
$file_info['APP13'] );

?>

 RESULT   

EXISTING IMAGE

x0006100.jpg

x0006100.jpg apr

Photoshop 3.08BIMTesteEFEITOSEFFECTS( Do not copy720110620PzerofU professorZS Paulo_SPeBrasiliTeste de Efeitos Nikon D5100t(c) 2011 by zerofxPSeja consciente.Evite copiar! (Be aware. Do not copy or use without permission!)zViewNX2

  3 EXERCISE   

<?php

$img_file 
"img/x0006100.jpg";

$img_info getimagesize($img_file$file_info);

echo 
basename($img_file) . '<br><br>
<img src="' 
$img_file '" alt="' 
$img_file '" title="' $img_file '" width="90%"><br><br>';

 
$iptc_block iptcparse($file_info["APP13"]);
 
echo 
'&nbsp;&nbsp;&nbsp;&nbsp;<pre style="color:#008;
 font-size:14px; font-style:italic;">+ '
 
$iptc_block["2#040"]["0"] . " +
 &nbsp;&nbsp;&nbsp;&nbspCopyright&nbsp;"
 
$iptc_block["2#116"]["0"] . '</pre>';

?>

 RESULT   

EXISTING IMAGE

x0006100.jpg

x0006100.jpg apr

+ Do not copy +
   Copyright (c) 2011 by zerof