Jump to content

iptcembed -orphan images


richardmorton

Recommended Posts

When I make dynamic thumbnails, they are produced as orphans (ie they have no metadata).  I am familiar with ways to get IPTC or EXIF data into such thumbnails if you go and actually write the file to disc, however I have more specific problem related to making them dynamically.  Below is a snippet of code  that is currently being used

 

// details of orig image

list($width, $height) = getimagesize($file);

// Resizing the Image (make up new modwith and modheight)

$tn = imagecreatetruecolor($modwidth, $modheight);

$image = imagecreatefromjpeg($file);

imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width,

$height);

// Outputting a .jpg,

imagejpeg($tn, null, 80);

What I would like to do is insert some IPTC headers into this exact process without changing the input or output - so the pseudocode for the revised  module would be

 

 

// details of orig image

list($width, $height) = getimagesize($file);

=== GET THE IPTC HEADERS FROM THE ORIGINAL  HERE =========

// Resizing the Image

$tn = imagecreatetruecolor($modwidth, $modheight);

$image = imagecreatefromjpeg($file);

imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width,

$height);

==RE-INSERT THESE IPTC HEADERS  =====

// Outputting a .jpg,

imagejpeg($tn, null, 80);

 

If anyone could help that would be most appreciated.  As regards getting the IPTC headers, clearly the php command iptcparse is the one, however I cannot get iptcembed to work.  Many thanks

 

Link to comment
https://forums.phpfreaks.com/topic/215689-iptcembed-orphan-images/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.