Images without extensions do not resize
dangrice - November 2, 2009 - 23:30
| Project: | Image Resize Filter |
| Version: | 6.x-1.5 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Description
The module works okay with normal links but does not seem to work with generated characters.. IE, like the ones from news sites.
http://www.bloomberg.com/apps/data?pid=avimage&iid=ibRQEnKp6k_U
http://a123.g.akamai.net/f/123/12465/1d/www.nationalpost.com/news/canada...
If I replace the link with another image, it works fine.
Drupal 6.9.. as I haven't had a chance to up my core yet.. if it matters..

#1
The problem here is that Image Resize Filter isn't able to determine what format the images are from looking at the URL. If the image were to end with png/gif/jpg it would work because Image Resize Filter knows what format to save in.
This problem should still be fixable, it'll just require a rather different approach for determining how to identify images and what to name the resized versions.
#2
Hmm.
Most of the links I need lack image extensions.. alas. I wasn't even concerned as much about resizing as having a local file copied to prevent against dead links..
#3
This patch mostly fixes the problem. When working with images without extensions, this will attempt to read the MIME-type information and create an extension from that. It works just fine for your second sample image, but not the first. I think it has to do with the Bloomberg system not setting all the necessary headers for PHP's getimagesize() function to read the image properly. The image from Akamai works great though.
I think it'd be good to commit this anyway, since it increases the number of situations that Image Resize Filter can handle, but not quite all of them.
#4
I've committed this patch as it will make most images without extensions work. I've opened a secondary issue at #633676: Some external images without extensions do not resize to handle external images that send back improper headers (such as the Bloomberg URL).
#5
Thanks!
#6
Automatically closed -- issue fixed for 2 weeks with no activity.