Posted by CosmicVoyager on August 16, 2006 at 6:59am
Jump to:
| Project: | Audio |
| Version: | 6.x-1.0-unstable5 |
| Component: | Miscellaneous |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
Would it be possible to get the album art to show up in the teaser, like the video module? Right now I'm using image_attach to upload a duplicate image of the album art, and deleting the original. It would be great if I could just use the integrated album art!
Comments
#1
i'd like to add support for that but in the mean time you could probably do it with your own theme function. i haven't tested this but it's basically a mash up of the theme_audio_teaser() and theme_audio_display() functions.
<?php
// override the colors on the flash player
function phptemplate_audio_teaser($node) {
// make sure that all the allowed tags are included.
foreach (audio_get_tags_allowed() as $tag) {
$params['%'. $tag] = isset($node->audio_tags[$tag]) ? $node->audio_tags[$tag] : '';
}
$params['%filelength'] = theme('audio_format_filelength', $node->audio_fileinfo);
$params['%fileformat'] = theme('audio_format_fileformat', $node->audio_fileinfo);
$params['%player'] = audio_get_player($node);
$params['%play_count'] = $node->audio_fileinfo['play_count'];
$params['%download_count'] = $node->audio_fileinfo['download_count'];
// THE DIFFERENCE IS HERE
// if there's an image, put it in as an %image parameter.
if ($image = audio_images_get($audio_images)) {
$params['%image'] = "<div class='audio-image'>\n" . theme('audio_image', $image) . "\n</div>\n";
}
// THAT'S IT
$format = variable_get('audio_teaser_format', '%player %filelength');
return t($format, $params) . $node->teaser;
}
?>
#2
Thanks, that worked, except
audio_images_get($audio_images)should beaudio_images_get($node->audio_images).#3
i've added this to a handbook page
#4
#5
i've added the code from the handbook to /themes/mytheme/template.php
but the album art doesn't appear in the teaser.. is there anything else i need to do?
(sorry but i'm a bit of a beginner on drupal hacks/mods)
#6
I am looking to do this for Drupal 6.
Any advice?
#7
Subscribing
#8
I posted this in a related thread:
http://drupal.org/node/113073
For the 6.x version, just add a line for the image token in the formatted file info section near line 1353 of audio.module.
// Formatted file info.$tokens['audio-length'] = theme('audio_format_filelength', $node->audio);
$tokens['audio-format'] = theme('audio_format_fileformat', $node->audio);
$tokens['audio-image'] = theme('audio_images', $node->audio_images);
Then add the [audio-image] token into the Teaser settings in the Audio Settings admin section.
#9
Thanks, that worked well. Now how would I style it so the image appears underneath the other 2 fields?