PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Images » Image_Transform » Bug #183

GD Driver discards altered image on save()

Details

Submitted2003-11-02 05:39 UTC
Fromieure at debian dot org
Assignedreywob
StatusNo Feedback
PackageImage_Transform
PHP VersionIrrelevant
OSLinux
Roadmaps(Not assigned)

Comments

[2003-11-02 05:39 UTC] ieure at debian dot org

Description:
------------
GD's save() method discards any changed made to the image. This is
not the behavior of (at least) the IM driver, and it seems rather
disingenuous to me.

Reproduce code:
---------------
$t = &Image_Transform::factory('GD');
$t->load('some_image.jpg');
$t->scaleMaxX(100);
$t->save('.thumbnails/some_image.jpg');
$t->display();

Expected result:
----------------
The altered image should be shown upon calling display(); save()
should not revert to the original image.

Actual result:
--------------
save() discards changes after saving, and display() shows the original
image.

[2003-11-07 17:39 UTC] reywob at php dot net

I've made some changes on my local copy which will be committed to CVS over the next couple of days, but I can't decide whether the default behaviour should be to forget the settings after calling save() or display() [which was the intended behaviour] or to remember them. Feedback appreciated as to which you'd expect it to be.

[2003-11-07 17:47 UTC] ieure at debian dot org

I would expect it to keep my changes, unless I explicitly
loaded the original file or asked for the changes to be
discarded.

This is bound to cause confusion, because the save() method
implies that it does one thing - save the image - when, in
fact it does two, save the image and revert to the
unmodified one. If the behavior is not changed, the
function should be renamed to "saveAndRevert" (or similar)
so it accurately reflects what the function actually does.

[2003-11-07 18:41 UTC] reywob at php dot net

Logic accepted :-)