Jump to:

7935 Posts in 1536 Topics by 943 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » ImageGallery rotate image bug

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1
Go to End
Author Topic: 921 Views
  • fabilo
    Avatar
    Community Member
    10 Posts

    ImageGallery rotate image bug Link to this post

    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.

    921 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.