Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
plugins-topic
File Uploader: the displays "[Image Can Not Be Found]" instead of the image
Avatar
Cristian Livadiotti
Member
Free Members
sp_UserOfflineSmall Offline
Mar 27, 2012 - 6:12 pm

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

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
Mar 27, 2012 - 8:27 pm

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...

Avatar
Cristian Livadiotti
Member
Free Members
sp_UserOfflineSmall Offline
Mar 28, 2012 - 2:09 am

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.

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Mar 28, 2012 - 4:52 am

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?

andy-signature.png
YELLOW
SWORDFISH
Avatar
Cristian Livadiotti
Member
Free Members
sp_UserOfflineSmall Offline
Mar 28, 2012 - 8:33 am

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.

Avatar
Cristian Livadiotti
Member
Free Members
sp_UserOfflineSmall Offline
Mar 28, 2012 - 8:47 am

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

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Mar 28, 2012 - 9:03 am

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...

andy-signature.png
YELLOW
SWORDFISH
Avatar
Cristian Livadiotti
Member
Free Members
sp_UserOfflineSmall Offline
Mar 28, 2012 - 9:06 am

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

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
Mar 28, 2012 - 9:36 am

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...

andy-signature.png
YELLOW
SWORDFISH
Avatar
Cristian Livadiotti
Member
Free Members
sp_UserOfflineSmall Offline
Mar 28, 2012 - 11:57 am

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 ?

Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 619
Members: 17362
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10127
Posts: 79625