enclosure - images -- not working
30equals - March 17, 2009 - 10:44
| Project: | Aggregation |
| Version: | 5.x-4.8 |
| Component: | Documentation |
| Category: | support request |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
hi everyone
according to this issue thread, and the documentation. images which are embedded in a feed as link rel="enclosure" , should get extracted and linked to that particular feed item.
well, this isn't working for me.
i've installed the image module, CURL is installed as well. i get my feeds without a problem, but the images are not there. there are no image nodes created.
and when i edit a feed which is generated, and look at the image id, it's still "0"
in the config page of aggregation i've set the following
Image to display on item full node display --> original
Image to display on item teaser node display --> original
is there anyone who has an idea how to get this working ? thanx!

#1
the issue thread i was referring to is
http://drupal.org/node/130896
#2
I have same or similiar problem.
I'm reading a particular XML structure called ONIX.
ONIX was created for book publishers due to exchange catalogue informations.
I've created just a basic feed_handler for ONIX and got it to work with aggreagtion.
It's creating feed_items but I can't get it to load the images.
I'm using drupal core 5.8 and aggreagtion 4.8
(I've upgraded from agregation 4.4 to 4.8 because according to release notes there was some "image" issue fixed in aggregation 4.7)
This is a part of the feed handler where I'm reading the image (f117)
$image_teaser = $onix->title->b203
$image_title = $onix->title->b203;
$image_url = $onix->mediafile->f117;
$image_body = $onix->b049;
// can be ommitted, then image URL will be our image GUID
//$image_array['guid'] = $image_guid;
// can be ommitted, then image will take article's title
$image_array['title'] = $image_title;
// if any of these is ommitted, the $image_title will be used instead
$image_array['teaser'] = $image_teaser;
$image_array['body'] = $image_body;
// This is A MUST if you're interested in getting an image at all
$image_array['url'] = $image_url;
This is the part of ONIX XML where the image URL is stored
04
03
72
01
http://www.example.com/cover_gross/9783503100057.jpg
I'm still not sure if I'm doing it wrong way, or there is still some kind of a bug.
function _aggregation_add_item($title, $body, $teaser, $original_author, $feed,
.
.
.
foreach ($image_array as $image)
{
if (!is_null($image['url'])) $image['url'] = trim($image['url']);
if (!$image['url'] || empty($image['url']))
$image = NULL;
else
{
if (!is_null($image['title'])) $image['title'] = trim($image['title']);
if (!is_null($image['guid'])) $image['guid'] = trim($image['guid']);
if (!is_null($image['teaser'])) $image['teaser'] = trim($image['teaser']);
if (!is_null($image['body'])) $image['body'] = trim($image['body']);
if (!is_null($image['url'])) $image['url'] = trim($image['url']);
What I've found out is, I'm not reaching this row
so I'm assuming the $image['url'] is not filled (? why ever).
Has Somebody any hints ?
Regards
#3
made a quick patch for D6 version - http://drupal.org/node/416818. Idea is quite simple, maybe someone can just backport it?
#4
Thanks for the patch.
I'll have a close look on it later and try it anwyway, now I wanted to say I found out what was wrong with the feed_handler. See Comment below.
Regards
#5
I finaly found out what was wrong in my feed_handler.
I have to pass the image_array where I collect the parameters as a row of the actual image_array like this:
// can be ommitted, then image URL will be our image GUID
//$image_array['guid'] = $image_guid;
// can be ommitted, then image will take article's title
$image_array['title'] = $image_title;
// if any of these is ommitted, the $image_title will be used instead
$image_array['teaser'] = $image_teaser;
$image_array['body'] = $image_body;
// This is A MUST if you're interested in getting an image at all
$image_array['url'] = $image_url;
// can be ommitted, then image will take current time
//$image_array['timestamp'] = $image_timestamp;
This the crutial part (not clean but understandable):
//print_r($image_array);
$image=$image_array;
unset($image_array);
$image_array[]=$image; // <=
_aggregation_add_item($title, $body, $teaser, $original_author, $feed,
$additional_taxonomies, $timestamp, $original_item_url, $guid, $image_array);
Since I do it this way it's loading the images as image node (ofcource image module has to be enabled to)