XML feed formats images as audio, uses wrong image sizes
| Project: | Views Bonus Pack |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
I'm trying to generate an XML feed to bring Drupal-managed images into Flash. I'm running into a strange issue, however.
It seems that somewhere in its internal mechanism the feed generation code is assuming that images are actually audio files. What I want to be able to do is easily assigned attributes for filename, width, and height, but when I dump out the contents of node_data_field_image_cache_field_image_cache_data, it contains attributes like audio_bitrate_mode, audio_channel_mode, and so on, as though an assumption has been made somewhere that it's meant to be used for a podcast.
Also, it does contain parameters for width and height, but they seem to be the attributes for the original image, not the imagecache profile version that I've selected for output in the feed.
Any suggestions on how to fix this would be greatly appreciated.

#1
You can try using some code from
theme_imagecache()<?php// $path is the path to your original image.
// $presetname is the imagecache preset.
if ($image = image_get_info(imagecache_create_path($presetname, $path))) {
$attributes['width'] = $image['width'];
$attributes['height'] = $image['height'];
}
?>
This will only work if the derivative already exists, so the first time you hit the image you won't get it's width and height, but from then on you should.