When a stream wrapper returns an empty string in the method "getDirectoryPath", it causes the regular expression in image_resize_filter_pathinfo to match all values by changing the regular expression to '/^\/?(.*)/'. It seems more reasonable to have the function skip if the return is empty.

Comments

ram4nd’s picture

Version: 7.x-1.x-dev » 7.x-1.16
Status: Active » Needs work
Issue tags: -stream wrappers
joelstein’s picture

I agree. Otherwise, if you try to resize a URL like "/modules/file/icons/application-pdf.png", and you've got Media Vimeo installed, you get a scheme like "vimeo://".

Fixing this would probably also fix #1207116: Image Resize Filter may create broken paths if height/width attributes are not available.

Here's a patch which will only match the stream wrapper if its directory path matches that of the file. Otherwise, it will fall back to "public://".

adamps’s picture

I confirm that the patch fixes #1207116: Image Resize Filter may create broken paths if height/width attributes are not available. Arguably the two issues are duplicates. The other was opened much earlier, has a lot more subscribers and has a clearly described repro scenario.

@joelstein Maybe you could close this one as a duplicate, and move your patch over there?

Anonymous’s picture

StatusFileSize
new1.06 KB

The patch would not install on my end, maybe it was developed against an old version.
Here is the corrected patch.

svenryen’s picture

Status: Needs review » Reviewed & tested by the community

I used the patch in #4 and it resolved my issue. I had old image links in my markup from a past domain, so when the image path was sites/old.domain.com/files/blah, the module would output an empty src for the image.

With the patch applied, both cases of image urls like /sites/old.domain.com/files/blah.jpg and /sites/default/files/blah.jpg would be resized properly, and I no longer see any empty src attributes.

  • ram4nd committed 7e3a933 on 7.x-1.x authored by joelstein
    Issue #2474757 by joep.hendrix, joelstein, svenryen: Empty...
ram4nd’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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