Support Forum

File Uploader: the displays "[Image Can Not Be Found]" instead of the image

CL Cristian Livadiotti
Cristian Livadiotti
Member

I just installed the File Uploader plugin, and I can’t make it work:

  • First it created all directories under wp-content/sp-resources (forum-image-uploads for ex, and all its subdir) with access rights 744 so it was not possible to display the images added there in a browser even by typing their complete URL
  • Now that I changed manually those rights to 755, the post displays [Image Can Not Be Found] whatever image I upload

Is there some configuration I forgot to do?

Thanks

20 Answers

New Answer

MP Mr Papa
Mr Papa
Member

well 0744 does not sound like good permission… when created, it should inherit from wp-content… can you check the permission on that folder? and sp-resources too…

CL Cristian Livadiotti
Cristian Livadiotti
Member

Thanks for your reply.

No, wp-content (and sp-resources below it) are both 755. It’s only the 3 folders created by plupload and their subdirectories that were created with 744.

But even when fixing it manually, the image still does not appear.

I removed the plugin, added it back, it recreated those folders with 744. I manually created another one (file-uploads under sp-resources), set it to 777, tried to attach an image to a post, and same result:

– now the subdir under file-uploads are all 777

– but if the image can be seen when clicking on the attachment link, it still displays [Image Can Not Be Found] in the post…

There is probably something wrong with my config, but I don’t know what! Thanks again for your support.

YS Yellow Swordfish
Yellow Swordfish
Member

I think the first thing we need to do is separate the issue of uploading permissions form the issue of retrieval and display. and  – I hope you will be willing to work with us a bit on this one. We had one other user also experiencing this but we never heard back from them.

Let’s deal with the permissions first. The install attempts to use 755 for the folders. The fact that they were created with a lower permission means the server config would not allow it. But 777 is not really desirable and some servers will not allow uploading into 777 – which we have surprisingly seen – as it is seen as a security risk.

So – the key to this part is does it perform the actual upload? Do the files arrive in their sub-folders on the server? And if that happens at 755 then that is what I would set them to.

Retrieval and display are, as I say, a different issue. Assuming the upload itself is a success then the real issue is why it can not be retrieved and this is where we need to do some experimenting with your help (hopefully!).

For starters – can you go to the forum admin > options > content settings – and turn off the option to use ‘popup image enlargement’. And let me know if uploaded images then display in posts?

CL Cristian Livadiotti
Cristian Livadiotti
Member

Yellow Swordfish said
I think the first thing we need to do is separate the issue of uploading permissions form the issue of retrieval and display. and  – I hope you will be willing to work with us a bit on this one. We had one other user also experiencing this but we never heard back from them.

I sure am 😉 I need this to work!

Yellow Swordfish said
Let’s deal with the permissions first. The install attempts to use 755 for the folders. The fact that they were created with a lower permission means the server config would not allow it. But 777 is not really desirable and some servers will not allow uploading into 777 – which we have surprisingly seen – as it is seen as a security risk.

I agree – I only tried 777 because I think I saw that in one of the help files. 755 is fine.

Yellow Swordfish said
So – the key to this part is does it perform the actual upload? Do the files arrive in their sub-folders on the server? And if that happens at 755 then that is what I would set them to.

Yes, they do. They are uploaded into a subfolder username/month/day, inside the image upload folder that is configured in the forum options. And by the way, I can point the browser to their URL and see them separately (or when clicking on the link in the attachment section of the post).

Yellow Swordfish said
Retrieval and display are, as I say, a different issue. Assuming the upload itself is a success then the real issue is why it can not be retrieved and this is where we need to do some experimenting with your help (hopefully!).

For starters – can you go to the forum admin > options > content settings – and turn off the option to use ‘popup image enlargement’. And let me know if uploaded images then display in posts?

I just tried to turn this off, and did the test again: still no luck, it displays [Image Can Not Be Found]. If I click on the image link in the “Attachment”, it does work.

CL Cristian Livadiotti
Cristian Livadiotti
Member

I did an additional test by:

– Integration – Storage Locations: setting the image upload folder in the options to sp-resources/file-uploads (permissions set to 755)

– cleaning up its content

– putting the “Use popup image enlargement” to off

– replying to a topic with a test.png image

 

Results:

– subdir admin/2012/03/_thumbs created OK – permissions OK (all 755)

– test.png file uploaded to admin/2012/03/ – file is OK

– _test.png file uploaded to _thumbs – file is OK, it’s a small version of the test.png file

– both files display well in a browser when fetched

 

But: still displays the [Image Can Not Be Found] in the post

YS Yellow Swordfish
Yellow Swordfish
Member

Would you be able and willing to edit some core plugin code? Mainly I would like to comment some code out to try and pinpoint the culprit…

CL Cristian Livadiotti
Cristian Livadiotti
Member

Yellow Swordfish said
Would you be able and willing to edit some core plugin code? Mainly I would like to comment some code out to try and pinpoint the culprit…

Sure no problem

YS Yellow Swordfish
Yellow Swordfish
Member

We might have to have a few stabs at this and sadly the file I want you to look at is the biggest in the plugin!

The file we need is located at: /sp-api/sp-api-filters./php

The function I would like to start with is named sp_filter_display_images() and it starts on line 1128 nearly two-thirds of the way through the file (I said it was big!)

Locate this block of code:

# see if we can determine if the image still exists before going further. So is it relative?
if (substr($src[1], 0, 7) == 'http://') {
    $response = wp_remote_get($src[1]);
    if (is_wp_error($response) || wp_remote_retrieve_response_code($response) != 200) {
        return '['.sp_text('Image Can Not Be Found').']';
    }
}

and comment it out.

It would be most helpful if we could stick with just that on the first test because a process of elimination is better. If this doesn’t work for us then we will need to make two more edits to the same file sadly. I hope that is OK…

CL Cristian Livadiotti
Cristian Livadiotti
Member

No commenting it out changes nothing. I changed the strings Image Can Not Be Found to add 1 or 2 at the end, and the error comes from the other place:

if (empty($width[1])) {
$size = getimagesize($srcfile);
restore_error_handler();
if ($gis_error == ”) {
if ($size[0]) {
$width[1] = $size[0];
} else {
return ‘[‘.sp_text(‘Image Can Not Be Found 2′).’]’;
}
}
}

I’ll try and look what’s wrong here, it seems that the getimagesize returns all 0 ?

CL Cristian Livadiotti
Cristian Livadiotti
Member

I just tried to comment the return line, and the image displays (not a thumb, large image is displayed within the post).

Maybe there is something wrong with my PHP config?

Note that it’s a PNG image, maybe that makes a difference?

YS Yellow Swordfish
Yellow Swordfish
Member

You can see that we are simply trying to establish the image width…

Good thinking on the debug numbers as well.

is there a chance you could ask you host about the getimagesize() function? This should NOT require the GD library to be compiled into your php but should be in the standard core. I would assume that if it did not exist we would get a fatal error so I doubt it is that. But they may know why we are unable to use it…

And meanwhile I will look into any method to bypass that if there is a problem…

CL Cristian Livadiotti
Cristian Livadiotti
Member

Hi, I did not find a reason explaining that the getimagesize would not work. I have a dedicated server I administer myself, maybe there is some configuration I need to change somewhere, but I did not find anything to date. Nor did I find a lot of people complaining that this information would not work.

The environment part of simple-press toolbox gives this – I don’t know if something is useful here:

Simple:Press

Version: 5.0.4
Build: 8189
Release: Release

WordPress

Version: 3.3.1
Language: en-US
Character Set: UTF-8
Theme: Optimize

PHP

Version: 5.3.8-pl0-gentoo
Memory: 128M
Max Upload: 50M
Timeout: 300

MySQL

Version: 5.0.44
Prefix: wp_

Server

Version: Apache/2.2.20 (Unix) mod_ssl/2.2.20 OpenSSL/0.9.8o

WP Plugins

CodeStyling Localization (1.99.16)
Share and Follow (1.80.3)
ShortCode – Get Child List (0.4)
Simple:Press (5.0.4)
Theme My Login (6.1.4)
WordPress Download Monitor (3.3.5.4)
WordPress FAQ Manager (1.14)
WordPress Importer (0.6)
WP Easy Uploader (1.0.11)

SP Plugins

Admin Bar (1.0.12)
File Uploader (using Plupload) (1.0.8)
Subscriptions (1.0.12)
Template Tags and Widgets (1.0.10)

YS Yellow Swordfish
Yellow Swordfish
Member

Most peculiar. And clearly a rare occurrence – you are, as I said, just the second user to have this issue.

I am going to have to ask you to bear with me on this one. I have been giving it quite a lot of thought since you raised the issue to see if I can come up with a differemt solution. One or two ideas but they are going to take me a littler while to write up and test out.

In the meantime, you should be able to avoid the issue by ensuring that all image tags have a width attribute. But I do assure you I am on the case!