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.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

No images found in (uploadfolder) after successfull upload


Reply

8 Posts   1706 Views

Avatar
Kalileo

13 July 2009 at 2:16pm (Last edited: 13 July 2009 2:17pm), Community Member, 127 Posts

New install of 2.3.2, I can upload images and files without problems. In Files & Images they are all shown. So far so good.

However in admin when I want to insert them in the content of a page, the only image which is shown is the Silverstripe logo in the Uploads folder. Also that is the only image having its thumbnail created there in the _resampled subdirectory.

I created a new folder in assets, called Pages, and uploaded plenty of images there. they are all there, and i can manually insert them in the content by specifying their path such as img src="assets/Pages/my-image-01.jpg, all images display fine. (Of course that is not a solution for the customer.) However in admin it only shows "No images found in Pages"

The webserver user and group have write rights to the assets folder, as said uploading itself works fine.

Possibly this is the same issue reported also here [url=http://silverstripe.org/general-questions/show/264062#post264062]Insert Image Files not updating[/url]

Any hints anyone?

Avatar
Kalileo

13 July 2009 at 3:03pm Community Member, 127 Posts

Just to be complete: No error whatsoever in the Apache error log

Avatar
Kalileo

13 July 2009 at 7:09pm Community Member, 127 Posts

Sniffing through the code I see that in ThumbnailStripField.php the images in a folder are searched with

$whereSQL = 'ParentID IN (' . implode(', ', $folderList) . ')';
$images = DataObject::get('Image', $whereSQL, 'Title');

which finds the SS logo, but not the other images.

The table File contains all images, but they are all having the enum Field ClassName set to File, and only the SS logo has it setto Image. That seems to be the reason why they are not recognized in admin as images.

Next question is why are they not having all ClassName = Image ?

Avatar
Kalileo

13 July 2009 at 8:26pm Community Member, 127 Posts

Manually changing the ClassName to Image does indeed make the pictures appear in admin, now they can be inserted into the content there.

Still the question is why are they not having all ClassName = Image ?

Avatar
Kalileo

13 July 2009 at 11:12pm Community Member, 127 Posts

Saphhire's Folder.php function constructChild($name) should set className = Image depending on the extension.

Line 142:

142: $ext = strtolower(substr($name,strrpos($name,'.')+1));
143: switch($ext) {
144: case "gif": case "jpg": case "jpeg": case "png": $className = "Image";


$name is set with basename($file).
Why did that not work?

Avatar
Kalileo

14 July 2009 at 1:46am Community Member, 127 Posts

Is /sapphire/filesystem/Folder.php overwritten somewhere?
I changed a few things, to debug this, but the changes seem not to get executed.

Avatar
Kalileo

14 July 2009 at 2:40am Community Member, 127 Posts

Yeah, that was it, it seems to be handled by the Data Objects manager, see [url=http://www.silverstripe.org/dataobjectmanager-module-forum/show/260986?start=16#post264167]this post and Cheeseuncles answers[/url]

Avatar
Kalileo

14 July 2009 at 6:27am Community Member, 127 Posts

The fix for the [url=http://www.silverstripe.org/dataobjectmanager-module-forum/show/260986?start=40#post264694]No images found problem is here[/url].

Summary:

Update dataobject_manager to at least revision 210, currently that is trunk.

svn co http://carlinowebdesign.svn.beanstalkapp.com/modules/trunk/dataobject_manager

That checks out revision 210, which indeed fixes the "no images found in folder" issue