Gallery changing original image when rotating

sp

Joined: 2002-08-16
Posts: 3
Posted: Fri, 2002-08-16 21:43

Is it possible to have a configuration option to the effect of "Never change original image"? I rotate my pictures quite a lot and love having the thumbnail and the scaled image turn the right way, but I would much rather that the original image wasn't messed with. Most of my images are 1600x1200, and I very rarely look at anything but the scaled image, but it would be nice to leave the original untouched for later printings, etc.

/sp

 
CarpetBagger
CarpetBagger's picture

Joined: 2002-08-09
Posts: 49
Posted: Sat, 2002-08-17 03:05

I'd be interested in the same thing. At least as an option during config.

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Tue, 2002-08-20 03:18

The plan for G2 is that it will never, ever touch the original image. We won't change the way this works in G1, though.

 
sp

Joined: 2002-08-16
Posts: 3
Posted: Sun, 2002-08-25 22:02

That sounds fair enough. Can anyone see through the php code enough to post a quick fix to the existing Gallery version so that the original picture isn't touched when rotating? I would really love to have this feature now

/sp

 
vallimar

Joined: 2002-08-15
Posts: 487
Posted: Sun, 2002-08-25 22:21

You should be able to do what you want fairly easily by modifying
the rotate() function in classes/AlbumItem.php. I'd make a patch
but I don't use resized images at all. A quick-n-dirty hack for what you
want would involve commenting out the code between:

$type = $this->image->type;
--- and ---
if ($this->isResized()) {

And then, instead of regenerating the thumbnail, possibly just rotating that as well.

rotate_image("$dir/$name.thumb.$type", "$dir/$name.thumb.$type", $direction);
list($w, $h) = getDimensions("$dir/$name.thumb.$type");
$this->thumbnail->setDimensions($w, $h);

However, that may not work to well with the thumbnail, especially if you then go
to make it a highlight image. To be safe, you could modify the makeThumbnail
code to always make thumbnails off the resized images instead of the original.

Anyhow, something like the above should work, give it a try and see what
happens.

 
sp

Joined: 2002-08-16
Posts: 3
Posted: Tue, 2002-08-27 15:02

Thank you for your help. The fix seems to work somewhat. The original is no longer touched, but the sized picture is rotated properly. The thumbnail is rotated too, but the aspect isn't changed, so the thumbnail ends up being stretched, and I can't really see how to fix that. I was hoping that it might be possible to regenerate the thumb from the sized picture instead of the original, but I can't figure out how.

/sp