ok...sono di nuovo qui.....problema risolto del tutto con l'altro script adesso mi servirebbe una mano per questo....
è uno script per il cambio degli iptc nelle immagini
Codice PHP:
<?php
$inizio = microtime(true);
$image_name_old = "test.jpg";
$image_name_new = "test2.jpg";
$size = GetImageSize("$image_name_old",&$info);
$iptc_old = iptcparse($info["APP13"]);
// Adding or replacing IPTC text
// This ex. replace the original category or create it if it dos not exist
$iptc_old["2#005"][0] = "Object Name";
$iptc_old["2#015"][0] = "Category: Categoria di prova";
$iptc_old["2#025"][0] = "Keywords1\nKeywords2\nKeywords3\n";
$iptc_old["2#055"][0] = "20080131";
$iptc_old["2#090"][0] = "Citta";
$iptc_old["2#095"][0] = "Stato";
$iptc_old["2#105"][0] = "Headline";
$iptc_old["2#116"][0] = "Copyright";
$iptc_old["2#120"][0] = "More caption text";
// Making the new IPTC string
foreach (array_keys($iptc_old) as $s)
{
// Finds the IPTC numbers
$tag = str_replace("2#", "", $s);
// Creating the string
$iptc_new .= iptc_maketag(2, $tag, $iptc_old[$s][0]);
}
// The original file and the new IPTC Text into $content
// Mode 0 - puts the image file into $content
// Mode 1 - puts the image file into $content and directly to the web client
// Mode 2 - puts the image file to web client
$mode = 0;
$content = iptcembed($iptc_new, $image_name_new, $mode);
$fp = fopen($image_name_new, "w");
fwrite($fp, $content);
fclose($fp);
// Function to format the new IPTC text, (thanks to Thies C. Arntzen)
function iptc_maketag($rec,$dat,$val){
$len = strlen($val);
if ($len < 0x8000)
return chr(0x1c).chr($rec).chr($dat).
chr($len >> 8).
chr($len & 0xff).
$val;
else
return chr(0x1c).chr($rec).chr($dat).
chr(0x80).chr(0x04).
chr(($len >> 24) & 0xff).
chr(($len >> 16) & 0xff).
chr(($len >> 8 ) & 0xff).
chr(($len ) & 0xff).
$val;
}
function output_iptc_data($image_path)
{
$size = getimagesize($image_path, $info);
if(is_array($info))
{
$iptc = iptcparse($info["APP13"]);
foreach(array_keys($iptc) as $s)
{
$c = count($iptc[$s]);
for($i=0; $i <$c; $i++)
{
echo $s." = ".$iptc[$s][$i]."
";
}
}
}
}
output_iptc_data($image_name_new);
echo "<a href=\"$image_name_new\" >Img</a>";
?>
Ok, questo era il codice.
Questo è il problema:
quando leggo l'immagine la prima volta legge tutto quello che c'è scritto (cioè niente, o quasi
), dopo prende le scritte che gli ho dato io e le scrive sull'immagine (e tutto bene), dopo salvo l'immagine sul pc e la vado ad aprire con photoshop e le info non ci sono....perche???
pensavo che non le scrivesse, ed ho fatto una prova...adesso legge, scrive e rilegge...e stampa a video le cose giuste, come se l'immagine fosse stata scritta correttamente...allora le cose che ho scritto sono incompatibili con photoshop?!?
uffa.....qualcuno mi può aiutare???
lo script è quello della pagina it.php.net/....../iptcembed.php (oppure era iptcparse?!?)