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

ImageGalleryPage - Error Saving Content


Go to End


56 Posts   17332 Views

Avatar
Wezzlee

Community Member, 28 Posts

5 October 2011 at 7:59am

Edited: 05/10/2011 8:43pm

Hi I think I am going insane right now. I have tried to solve it myself but after three days I am willing to throw the white towel in the ring.

- I am using the ImageGallery v536, uploadify 534 and DataObjectManager-master-HEAD.
- I have deinstalled all these plugins and installed them again.
- I have deleted all imagegallery DB entries and installed image gallery again (and run ad dev/build)
- I have used the PHP fix as suggested by silverseba
- I have CHMODded the directories: assets, image_gallery, DOM and uploadify to 777

And even when I have tried everything I still cannot create an image gallery page, because the "Error Saving Content" message appears.

Who can help me with this. Please.

Avatar
SSadmin

Community Member, 90 Posts

5 October 2011 at 9:31am

Hey, Wezzlee.
Can you please provide the detail error message using firebug.
After you install firebug, turn on the "Network" panel, and after you click create the page, you should seen the error message down belown in "red" fonts.
Then, we can take from there for better problem solving.

Regards
Alex

Avatar
Wezzlee

Community Member, 28 Posts

5 October 2011 at 8:18pm

Hi SSadmin,

The following error message appears:

ERROR [Warning]: rename(/home/httpd/vhosts/website.nl/httpdocs/silverstripe/assets/image-gallery/New-ImageGalleryPage/,/home/httpd/vhosts/website.nl/httpdocs/silverstripe/assets/image-gallery/Gallery-4/) [<a href='function.rename'>function.rename</a>]: No such file or directory
IN POST /silverstripe/admin/EditForm
Line 421 in /home/httpd/vhosts/website.nl/httpdocs/silverstripe/sapphire/filesystem/File.php

Source
======
412: // Only throw a fatal error if *both* before and after paths don't exist.
413: if(!file_exists($pathBeforeAbs)) throw new Exception("Cannot move $pathBefore to $pathAfter -
$pathBefore doesn't exist");
414:
415: // Check that target directory (not the file itself) exists.
416: // Only check if we're dealing with a file, otherwise the folder will need to be created
417: if(!file_exists(dirname($pathAfterAbs))) throw new Exception("Cannot move $pathBefore to
$pathAfter - Directory " . dirname($pathAfter) . " doesn't exist");
418: }
419:
420: // Rename file or folder
* 421: $success = rename($pathBeforeAbs, $pathAfterAbs);
422: if(!$success) throw new Exception("Cannot move $pathBeforeAbs to $pathAfterAbs");
423: }
424:
425:
426: // Update any database references
427: $this->updateLinks($pathBefore, $pathAfter);

Trace
=====
<ul>rename(/home/httpd/vhosts/website.nl/httpdocs/silverstripe/assets/image-gallery/New-ImageGalleryPage/,/home/httpd/vhosts/website.nl/httpdocs/silverstripe/assets/image-gallery/Gallery-4/)
line 421 of File.php

File->updateFilesystem()
line 339 of Folder.php

Folder->updateFilesystem()
line 368 of File.php

File->onAfterWrite()
line 1056 of DataObject.php

DataObject->write()
line 91 of ImageGalleryPage.php

ImageGalleryPage->checkFolder()
line 63 of ImageGalleryPage.php

ImageGalleryPage->onAfterWrite()
line 1056 of DataObject.php

DataObject->write()
line 749 of LeftAndMain.php

LeftAndMain->save(Array,Form,SS_HTTPRequest)
line 329 of Form.php

Form->httpSubmission(SS_HTTPRequest)
line 143 of RequestHandler.php

RequestHandler->handleRequest(SS_HTTPRequest)
line 161 of RequestHandler.php

RequestHandler->handleRequest(SS_HTTPRequest)
line 147 of Controller.php

Controller->handleRequest(SS_HTTPRequest)
line 282 of Director.php

Director::handleRequest(SS_HTTPRequest,Session)
line 125 of Director.php

Director::direct(/admin/EditForm)
line 127 of main.php

</ul>

Avatar
StefanDpunkt

Community Member, 14 Posts

18 October 2011 at 1:03am

Hallo @ll!
I have the same problem.

Is there a solution?

best regards

Avatar
Wezzlee

Community Member, 28 Posts

19 October 2011 at 11:52pm

Hi StefanDpunkt,

I have posted this question already a while ago and so far no help. There were some SS users on Twitter that tried to help, but asking for help on this forum is not really useful. My problem is still not solved. Maybe we should create a special forum with ImageGallery issues, because I never experience problems with SS, only with the plugin that is provided by UncleCheese.

I still think that is an ownership problem. The gallery directories are created by ImageGallery and cannot be edited.

Please let me know when you have solved this problem. So I can continue with the website that I have build and cannot be finished due to this annoying problem.

Avatar
Jarek

Community Member, 30 Posts

3 November 2011 at 6:00am

ImageGallery is very useful plugin but has too many bugs. Some of them:
* in onbeforedelete functions child records are removed without exist check (missing if ($this->xxx->ID != 0))
* when gallery root folder has been deleted, each time gallery page is saved new folder (record in File table) is created
* rename bug

In my case rename bug occurs when there is already folder with same name as changed gallery name. Those steps will force error:
1. go to files&images menu and make new folder (with name "abc") in gallery folder(!). New folder should have same parentID as gallery folder parentID.
2. go to galley page and change it's name to "abc"
3. save page
4. error will occur. On disk folder name will be changed to "abc-2" but error will show problem with rename "abc-2" to "abc-3". It looks like check folder function is called twice.

For me solution was to change $folder->setName(...); to $folder->Title = .... On disk folder name will be always the same but in files&images folder name will be updated each time gallery name is changed.

Avatar
silverseba

Community Member, 26 Posts

3 November 2011 at 9:45pm

Did you try the latest ImageGallery build from github: https://github.com/unclecheese/ImageGallery/downloads ?

The bugs Jarek mentioned should be fixed in this version.
I´m using this code on a public website and don´t have any errors or other issues any more.

Before you update the "image_gallery" folder on your project, make sure to delete all galleries, folders and images created with the old ImageGallery. You should delete them from the database as well as from the filesystem.

The best way for you to check if the current version is working for you is to set up a fresh SS install and test ImageGallery there.

Avatar
Jarek

Community Member, 30 Posts

25 November 2011 at 3:57am

I've installed clean version of silverstripe and image gallery and I've errors. One bug in ImageGalleryItem is fixed there is exsits check (but delete is commented)

if($this->Image()->exists()) {
//$this->Image()->delete();
}

In ImageGalleryAlbum Folder is still deleted without check

function onBeforeDelete()
{
parent::onBeforeDelete();
$this->GalleryItems()->removeAll();
$this->Folder()->delete();
}

Other two bugs aren't fixed. To fix second one (with deleted folder) checkFolder code should check not only RootFolderID but also folder record in Files table:

if( ! $this->RootFolderID || select count(*) from Files where ID = RootFolderID == 0) {...

Go to Top