Just testing 2.x-dev. If I choose an image field from a field collection, the image source is output with the correct directory path but no filename component.
It looks like this code from template_preprocess_field_slideshow() is tripping things up:
// Generate the image html
$image = array();
$image['path'] = $item['uri'];
$image['attributes']['class'] = array('field-slideshow-image', 'field-slideshow-image-' . (1+$num));
$image['alt'] = isset($item['alt']) ? $item['alt'] : '';
if (isset($item['width']) && isset($item['height'])) {
$image['width'] = $item['width'];
$image['height'] = $item['height'];
}
elseif ($item["type"] == 'image') {
$image_dims = getimagesize($image['path']);
$image['width'] = $image_dims[0];
$image['height'] = $image_dims[1];
}
else {
$image = array(
'width' => 0,
'height' => 0
);
}
In my case, $item has a path but no width or height, and $item['type'] is not set.
Comments
Comment #1
johnpitcairn commentedComment #2
johnpitcairn commentedThe check for $item['type'] is new in 2.x it seems. In 1.x, the code looked like this:
Comment #3
johnpitcairn commentedIn field_slideshow_field_formatter_view(), when the field type is tested for field collection support, I think we should add
$items[$delta]['type'] = 'image'. There isn't anything else it can be at this stage, because the settings form only allows selection of an image field from within the field collection.Patch to come.
Comment #4
johnpitcairn commentedAnd patch (1 line).
Comment #5
johnpitcairn commentedComment #6
adammichaelroach commentedPatch from #4 worked for me when the images weren't showing on a slideshow for a field collection.
Comment #7
johnpitcairn commentedThanks. Please set the status to RTBC. I'll get scolded if I do it ;-)
Comment #8
johnpitcairn commentedThis patch in combination with the Picture support patch at #2268419: Enable picture support will break the field structure in a fairly bizarre way. Perhaps this is not the way to go about it.
Comment #9
johnpitcairn commentedComment #10
johnpitcairn commentedSetting the item type to "image" is not the way to go. This patch sets the item type to "field_collection", and explicitly tests for that in preprocess. It will play nice with the Picture support patch.
Comment #11
Alexandre360 commentedI confirm the issue and I confirm that the patch fix the problem. Should be commited.
Comment #12
shenzhuxi commentedSeems it has been fixed.