Hi again! I'm glad for the new css selector - it seems to work nicely and it's pretty user-friendly. Another problem has come up that I'd like to work through: I can't seem to get it to retrieve images from certain feeds.

First the background:
Drupal: 6.13
CCK: 2.5
Imagefield: 3.1
Filefield: 3.1
OS: Centos
Perms: tmp:777 / files: 777
Imagefield configuration: set to show up in nodes and teasers with imagecache presets
Expected results: standard - as it was working a few days ago with version 1.x dev
Actual results and steps:

The images for this feed are never downloaded. I've done a bit of searching and it seems to be an issue with the way imagegrabber handles cron caching, but I don't have time to investigate fully.

I set up the feed as follows:
http://dnotes.net/screencasts/20091002-sxa-116kb.jpg

When I refresh the feed, I get all the feed results, and a note which tells me that imagegrabber has completed successfully; however, the first post should have a picture and it does not:
http://dnotes.net/screencasts/20091002-j70-69kb.jpg

Here is the original post from the feed, with the image that should be picked up:
http://dnotes.net/screencasts/20091002-r2p-239kb.jpg

So, I try hitting the "Grab Images" button and it gives me a confirmation screen:
http://dnotes.net/screencasts/20091002-jtx-34kb.jpg

And when I click yes, I receive a message that there are no feed items to download:
http://dnotes.net/screencasts/20091002-3v5-67kb.jpg

Comments

publicmind’s picture

Assigned: Unassigned » publicmind
Status: Active » Closed (works as designed)

Hi,

"it seems to be an issue with the way imagegrabber handles cron caching"

It is not a problem of cron caching but imagegrabber can not handle tags with multiple classes. This is the tag you want to select:

<div class="field field-type-filefield field-field-image">

but because of the design of imagegrabber, it doesn't recognize this with class 'field-field-image'. As I am not an regex expert, I am working on my current query:

$class = "foo";
$xpath->query("//*[@class = '".$class."']");

to select the elements with multiple classes. If you can help, it will be great.

You can see the results of the 'feed refresh' when I changed the class description to 'field field-type-filefield field-field-image' (You can not change this from the interface, as no spaces will be allowed in class name, I changed directly into the the database)

http://publicmind.in/drupal/feed-item/2283

the last 2 items do not have a image, whereas the third item has a malformed image URL (url with spaces is considered malformed by the script).

I will change it to 'by design' and will update it as I resolve the issue.

Thanks for reporting the issue with such detailed explanation.

publicmind’s picture

Hi,

One more thing, clicking on 'grab images' will only download images for those feed-items which were not processed due to lack of execution time and not who failed to get an image or resulted in error.

Also, after a cron run, some feed-items might not have the images due to lack of execution time (which is not probable as cron execution time limit is 120 seconds for imagegrabber), so it is always safe to click on 'grab images' after a cron run. To automate this process at the next cron run is already in the to-do list.

Thanks,

publicmind’s picture

Title: Refuses to grab images from some feeds » Refuses to grab images from some feeds | HTML elements with more than one css class not selected

The issue has been fixed, I will soon put up a patch as well as release the dev version updating it.

For a quick fix:

change line no. 651 in feedapi_imagegrabber.module :

$items = $xpath->query("//*[@class = '".$id_class_description."']");

with

$items = $xpath->query("//*[@class and contains(concat(' ',normalize-space(@class),' '),' $id_class_description ')]");

Thats all what needs to be done.

publicmind’s picture

Status: Closed (works as designed) » Fixed

It is now fixed in dev version. Visit: http://www.publicmind.in/files/FIG_readme.html

publicmind’s picture

Status: Fixed » Closed (fixed)

FeedAPI ImageGrabber v1.9 has been released. The new release resolves this issue. Please do post your comments about the new release , I am always looking for your feedback.

netentropy’s picture

I am unable to get this to work with the 1.9 or dev version, if i state no class or id then it will probably download the sites logo but if will not download the class "field-field-ff"