show album art in teaser?

CosmicVoyager - August 16, 2006 - 06:59
Project:Audio
Version:6.x-1.0-unstable5
Component:Miscellaneous
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

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!

#1

drewish - August 16, 2006 - 16:00

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

CosmicVoyager - August 16, 2006 - 21:30

Thanks, that worked, except audio_images_get($audio_images) should be audio_images_get($node->audio_images).

#3

drewish - September 14, 2006 - 17:28
Status:active» fixed

i've added this to a handbook page

#4

Anonymous - September 28, 2006 - 17:31
Status:fixed» closed

#5

kevinbroome - March 27, 2008 - 12:52
Component:User interface» Miscellaneous

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

rajaito - June 11, 2009 - 06:25
Status:closed» active

I am looking to do this for Drupal 6.

Any advice?

#7

CinemaSaville - September 17, 2009 - 22:29

Subscribing

#8

riskyfuel - October 27, 2009 - 23:04

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

CinemaSaville - October 28, 2009 - 00:05
Version:4.7.x-1.x-dev» 6.x-1.0-unstable5

Thanks, that worked well. Now how would I style it so the image appears underneath the other 2 fields?

 
 

Drupal is a registered trademark of Dries Buytaert.