Even if multiple images are available, only the last one (so the smallest one!) is included. This is because of a minor bug in which the image counter isn't incremented. Patch attached.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

MrNeko’s picture

Hi I tried applying the patch but it doesn't let me. Tried on latest 7.x-1.x-dev using netbean. Can anyone help me with this? Thanks.

rooby’s picture

Status: Active » Needs review

Thanks, that should fix it (just looking at the code, haven't tried to apply yet).

Better would be an option to choose what to do when there are multiple images but that can be another feature added later (#1793998: Give options for what to do if multiple images are found).

rooby’s picture

@MrNeko,

When I get a chance I'll try it and re-roll it if necessary.

If you are feeling adventurous you could also apply it manually seeing as it is so small.

All you have to do it put the $image_count++; line in where it goes.

acrollet’s picture

Priority: Normal » Critical
Status: Needs review » Reviewed & tested by the community

The patch in the summary applies cleanly to 7.x-1.x-dev for me - works great, it would be good to get this in since it greatly affects the central functionality of this module.

acrollet’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
3.34 KB

I spoke a bit too soon, the attached patch increments the image counter before checking to see if it is equal to the cardinality setting. This prevents an additional image from being downloaded and cluttering up the files directory. There is also a bit of whitespace cleanup for the function in this patch.

rooby’s picture

Thanks, I will do a run of review / commits tonight.

rooby’s picture

Status: Needs review » Fixed

Good catch.

I have committed this minus the whitespace fixes. I will fix those in a separate commit. Best to keep them separate.

I also also added a change so that it only sets the field once instead of overwriting it every new image.

http://drupalcode.org/project/feeds_imagegrabber.git/commit/5cbea2b

Status: Fixed » Closed (fixed)

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