Does not generate proper output whem ImageField has multiple values in a single field (Drupal 6)

dlrush - December 16, 2008 - 18:51
Project:Media RSS
Version:6.x-2.3
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

If a CCK ImageField is configured to support multiple values, then the Media RSS module generates incorrect output. Specifically, it appears to repeat the first value in multiple mediarss xml nodes.

The use case here is that a view should be created to return all of the ImageField values in MediaRSS format for a single node:

http://examples.com/node/nid/images - returns mediaRSS xml for just that node.

Problem could be in the iterator:

if(module_exists('imagefield') && $item->type==$mediarsstype){
foreach($imagefields as $imagefield){
if($item->{$imagefield}[0]['filepath']){
$imagecache = $this->options['mediarss_cachepreset'];
$picture_text = l(theme('imagecache', $imagecache, $item->{$imagefield}[0]['filepath']), url("node/".$item->nid), array('html' => TRUE));
$attributes['url'] =  file_create_url($item->{$imagefield}[0]['filepath']);
$media['url'] = $attributes['url'];
$media['type'] = file_get_mimetype($item->{$imagefield}[0]['filepath']);
$extra = array_merge($extra,
array(
array('key' => 'media:content', 'attributes' => $media),
array('key' => 'media:thumbnail', 'attributes' => $attributes),
)
);
}
}

#1

Microbe - December 16, 2008 - 20:17
Version:6.x-2.1» 6.x-2.3
Status:active» fixed

problem was it was looking at $item->{$imagefield}[0]['filepath'] whereas there could also be a picture under

$item->{$imagefield}[1]['filepath']
$item->{$imagefield}[2]['filepath']
$item->{$imagefield}[3]['filepath']
......

it now cycles through all existing values and enters them all

#2

System Message - December 30, 2008 - 20:20
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.