This one took at least 2 hours to find.. Augh..

feeds_imagegrabber_validate_download_size returns -1 for any image that doesn't have $result->headers['Content-Length']; set. This is all fine and dandy, but all my images from a particular server were coming up gone! After an hour of searching, I noticed.. $result->headers['Content-length']; See it? it's the lowercase "l" in "length"!

You could force the keys for headers to be all lowercase, and only check for the lower version .. or even only do it locally with array_change_key_case (though I'm not sure if that's safe on multi dimensional arrays).

Comments

publicmind’s picture

Category: bug » feature
Priority: Normal » Minor

I do not see any problem with converting keys to LOWER CASE but even the Drupal API (drupal_http_request) uses CASE SENSITIVE keys for Location, User-Agent, etc. So I am a little apprehensive about the proposed solution. Also, some servers do not even send the 'Content-Length' key.

The design of feeds_imagegrabber_scrape_images allows you to bypass the validation of image size ($option['getsize'] = FALSE) but you can not set it through the interface yet. Also, you won't be able to compare the scraped images based on their sizes.

Cheers,

techninja’s picture

Thanks.. Here's hoping that comes in eventually, not that removing getsize is a perfect fix.

Considering dealing with external feeds means dealing with "other people's servers" it wouldn't be such a nasty hack to add in some options to get around common issues. Of course, I have no idea if the the latter, or #882968: Certain feeds URLs redirect to their doom? are common issues. In the mean time I guess I'll be keeping my own version. Thanks again for the quick response.

Cheers--

publicmind’s picture

Assigned: Unassigned » publicmind
Status: Active » Fixed

It should now be fixed in dev. Please test it and let me know.

Thanks,

Status: Fixed » Closed (fixed)

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