That's because the image style function (http://api.drupal.org/api/drupal/modules%21image%21image.module/function...) always creates the full url to the image.

There's a bigger irony here. In case the image style has not been created yet, this test will also fail, so we should strip off the 'styles/public/style_name' off as well.

Patch coming up.

Comments

swentel’s picture

Status: Active » Needs review
StatusFileSize
new850 bytes

We need a strategy as well to strip of the style name, so the patch definitely needs work, but setting to 'needs review' to get some attention.

naxoc’s picture

StatusFileSize
new667 bytes

You are right. The code is a relic from the D6 and will never work.

The check for the existence of the file should be on the actual path and not the derivative. Here is a patch that uses a (horrible) regexp to get the path. It works, but it is not pretty.

I am not super sharp on stream wrappers so please take the patch for a spin and see if you can shoot it down.

frjo’s picture

StatusFileSize
new689 bytes

Here is my patch for this problem. I believe it will work for public, private and any other schema as well.

naxoc’s picture

Issue summary: View changes
Status: Needs review » Fixed

I committed the patch from #3 with a small change.

This took way too long. Sorry about that. Will try to make a release a soon as possible.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

shiraz dindar’s picture

Status: Closed (fixed) » Needs review
StatusFileSize
new593 bytes

I had a situation where filenames had colons in them. These are considered legit by the filesystem but drupal urlencodes the filename, and thus are unmatched when checked by the missing images option (always fails). Here's a simple patch to urldecode() the filename.

I've also switched to file_exists from is_file because is_file can return false when the file acctually exists (see: http://stackoverflow.com/questions/12173865/php-is-file-always-return-false). file_exists is the correct function to use here.

shiraz dindar’s picture

shiraz dindar’s picture

shiraz dindar’s picture

I used the wrong comment number in the patch name, but you get the idea.