[dev] Ansel / copy image functionality

Chuck Hagenbuch chuck at horde.org
Sat May 12 01:08:42 UTC 2007


Quoting Michael Rubinsky <mike at theupstairsroom.com>:

> I was going to re-implement the 'image copy' functionality that was   
> removed when the image data was removed from datatree.  I remember  
> at  that time, we had a discussion as to why it was removed and  
> Chuck, you  had said that it was currently broken since, for one, it  
> didn't copy  attributes. (See  
> http://marc.info/?l=horde-dev&m=116550803912849&w=2)   My question  
> is, I don't see any reason why something simple like the  following  
> wouldn't work it seems to duplicate the image correctly,  along with  
> the EXIF data (which is taken from the raw image data).
>
> <code>
> $oldImg = $GLOBALS['ansel_shares']->getImage($id);
> $newGal = $GLOBALS['ansel_shares']->getGallery($gal_id);
> $result = $newGal->addImage(array('image_caption' => $oldImg->caption,
>                                'data' => $oldImg->raw(),
>                                'image_filename' => $oldImg->filename,
>                                'image_type' => $oldImg->type));
>
> </code>

As you said this would miss the tags (probably want them on a copy).  
The other thing is that if the image has been manipulated at all, the  
raw data won't have the exif tags in it anymore.

-chuck


More information about the dev mailing list