1 pièce(s) jointe(s)
[Images] Pixels par pouce
Bonjour à tous :P
depuis des mois je travaille sur la création d'un exif sur des images.
Pour cela j'utilise la biblio Pel.
Mon client me dis que les métadonnées de l'image sont toujours pas bonnes:
voir image jointe
Cependant je renseigne bien la resolution par tout là il le faut. Mon code
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
require_once('pel/PelDataWindow.php');
require_once('pel/PelJpeg.php');
require_once('pel/PelExif.php');
require_once('pel/PelTiff.php');
require_once('pel/PelIfd.php');
require_once('pel/PelTag.php');
require_once('pel/PelEntryRational.php');
$data = new PelDataWindow($imageData1);
if (PelJpeg::isValid($data))
{
$jpeg = $file = new PelJpeg();
$jpeg->load($data);
$exif = new PelExif();
$jpeg->setExif($exif);
$tiff = new PelTiff();
$exif->setTiff($tiff);
// creation du IFD0
$ifd0 = new PelIfd(PelIfd::IFD0); // rattaché au tiff
// le ifd1 --> VIGNETTE
$ifd1 = new PelIfd(PelIfd::IFD1);
// resolution sur le ifd1
$resolutionX1= new PelEntryRational(PelTag::X_RESOLUTION,array(300, 1));
$ifd1->addEntry($resolutionX1);
$resolutionY1= new PelEntryRational(PelTag::Y_RESOLUTION,array(300, 1));
$ifd1->addEntry($resolutionY1);
$unit1 = new PelEntryShort(PelTag::RESOLUTION_UNIT,2);
$descr1 = new PelEntryAscii(PelTag::IMAGE_DESCRIPTION, "ceci va à la vignette");
$ifd1->addEntry($descr1);
$ifd1->addEntry($unit1);
$ifd0->setNextIfd($ifd1);
/* CAMERA */
// resolution sur le ifd0
$resolutionX0= new PelEntryRational(PelTag::X_RESOLUTION,array(300, 1));
$resolutionY0= new PelEntryRational(PelTag::Y_RESOLUTION,array(300, 1));
$ifd0->addEntry($resolutionX0);
$ifd0->addEntry($resolutionY0);
// il faut ajouter aussi l'unité
$unit0 = new PelEntryShort(PelTag::RESOLUTION_UNIT,2);
$ifd0->addEntry($unit0);
$descr0 = new PelEntryAscii(PelTag::IMAGE_DESCRIPTION, "ceci va au tag Camera");
$ifd0->addEntry($descr0);
// creation du SubIFD qui cree l'EXIF
$SubIFD = new PelIfd(PelIfd::EXIF); // sub du idf0
$ifd0->addSubIfd($SubIFD);
$idf2 = $ifd0->getSubIfd(PelIfd::EXIF);
$resolutionX2= new PelEntryRational(PelTag::X_RESOLUTION,array(300, 1));
$resolutionY2= new PelEntryRational(PelTag::Y_RESOLUTION,array(300, 1));
$unit2 = new PelEntryShort(PelTag::RESOLUTION_UNIT,2);
$descr2 = new PelEntryAscii(PelTag::IMAGE_DESCRIPTION, "ceci va ???");
$idf2->addEntry($descr2);
$idf2->addEntry($resolutionX2);
$idf2->addEntry($resolutionY2);
$idf2->addEntry($unit2);
$tiff->setIfd($ifd0); // rattaché au tiff
$upload = file_put_contents($hostname1, $file->getBytes(), 0, $stream_context); |
Comme vous voyez dans mon image il y ancore des données mal reseignées, et je n'arrive pas à trouver pourquoi
quelqu'un pourrait m'aider, je suis désespérée :arf::arf::arf::arf::arf::arf:
merci de vos lumières j'en ai vraiment vraiment besoin