Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, Ed, biapar, Willr, Ingo, swaiba

ImageGallery rotate image bug


Go to End


1717 Views

Avatar
fabilo

Community Member, 10 Posts

8 September 2010 at 12:11pm

I just worked through a random bug with the ImageGallery module. I'm not exactly sure what version it is, but it's a recent one. This may help someone else.

The bug appears when your in the admin backend, then clicking on an image in the "Photos" tab, then trying to rotate the image.
It looks like the bug only happens when you don't have your ss installation in the root dir, and therefore using .htaccess to reroute urls.

Firebug returns a 500 error like so:

ERROR [Warning]: copy(/Users/username/Clients/clientname/ss//domain.co.nz/ss/assets/image-gallery/Gallery/default-gallery/_resampled/rotateclockwise-016.jpg): failed to open stream: No such file or directory
IN GET /domain.co.nz/ss/ImageGalleryManager_Controller/rotateimage/24/cw?flush=1
Line 206 in /Users/username/Clients/client/htdocs/ss/image_gallery/code/ImageGalleryManager.php

I edited the working directory to hide client info etc.

Solution
To fix I edited the rotateimage() function in ImageGalleryManager.php & changed the line:

$url = $this->urlParams['OtherID'] == 'cw' ? $image->RotateClockwise()->URL : $image->RotateCounterClockwise()->URL;

to:
$url = $this->urlParams['OtherID'] == 'cw' ? $image->RotateClockwise()->Filename : $image->RotateCounterClockwise()->Filename;

This way the code only worries about the dir path from the root of the install, rather than the url etc.