Hi Kyle,

I got the Slideshowpro to work with the Views plugin. Its absolutely awesome, works beautifully. I'm wondering is it possible to feed audio to the slideshowpro through the fields in Views?

Regards,

Chris

Comments

kylebrowning’s picture

Its a bit difficult to do considering Slideshowpro only supports audio per instance of Slideshowpro.

So, the easiest way to do it, is to override

function theme_ssp_views_images($view, $op = 0, $args = '') {
  global $base_path;
  $audio_file = $base_path.$node->field_audio[0]['filepath'];
  $audio_caption = $node->field_audio[0]['data']['description'];
  if($args) {
    $args = unserialize(base64_decode($args));
  }
  else {
    $args = array();
  }

  if($audio_file != $base_path) {
    $audio = 'audio="'.$audio_file.'" audioCaption="'.$audio_caption.'"';
  }
  print '<?xml version="1.0" encoding="UTF-8"?>
          <gallery>
           <album id="ssp" title="'.$node->title.'" description="'. strip_tags($node->body).'" '. $audio .' >';
  $views = views_get_view($view);
  $views->set_arguments($args);
  $views->args = $args;
  $views->preview($op, $args);
  $result = $views->result;
  $images = array();
  $nodes_seen = array();
  foreach($result as $node) { 
    $node = node_load($node->nid);
    $field = _get_node_field_type($node);
    if($field && !in_array($node->nid, $nodes_seen) && is_array($node->$field)) {
      foreach($node->$field as $image) {
        $src = $base_path.$image['filepath'];
        $description = $image['data']['description'];
        $title = $image['data']['title'];
        $thumbnail = imagecache_create_url('ssp_thumbnail', $image['filepath'], TRUE);
        if(is_array(file_validate_is_image($image))) {
            print '<img src="'. $src .'" title="'. $title .'" caption="'. $description .'" link="" target="_blank" pause="" tn="'.$thumbnail .'" vidpreview="" />' . "\n";
        }

      }
    $nodes_seen[] = $node->nid;
    }
  }
  print '</album></gallery>';
}

And set audio file to be whatever you want to be.

The more drupal way of doing it, would be for me to provide a place where you can Define the audio per display of a view. Ie. Block_1, has audio a, block_2 has audio b...etc.

If the first route doesnt suite your needs, give me till the weekend to fix it up for you so I can get the second way into the module.

I dont really see it working either way, and I certainly dont have a way for you to upload audio inside of the views settings, its unfortunate, but at least this way, you can upload the file however you want. I imagine since you're creating the view, you have admin access and can upload files, so from a user standpoint, I really think the second option is the best solution. Otherwise you would have the same audio for every single Slideshow, of course you could switch on the block->title and all that, But shouldnt the module do it for you.

Enough rambling... ;)
Let me know what you think.

chrisck’s picture

Thanks for providing the first solution. I do have admin access however, I'm looking for the integration via user standpoint (for clients). Per node, I have a uploaded a set of images and an audio file. I have set an argument for the nid, and that way the ssp calls the correct content from the specific node. The images on the node are working perfectly, but the audio would be a great implementation too.

Also I did notice in the latest update, in the 'slideshow' content type created from the module:
In the audio upload field, the default file format is ".txt", should this be an audio format as default?

I'll be patiently waiting for your second solution, in your own time however. The first solution isn't really suited for client flexibility.

Thank you kindly,

Chris

chrisck’s picture

Any progress with the audio integration?

radiofranky2009’s picture

I can't get ssp to work with drupal. somehow it doesn't take the selected pictures.

when I "publish" swf, what "XML file path" should I specify?

thanks

kylebrowning’s picture

radiofranky2009,

You shouldn't be publishing anything. The slideshow pro use of this module is from the STANDALONE version of slideshowpro.

radiofranky2009’s picture

so that means I can't use the one I generated from macromedia flash?

kylebrowning’s picture

Not currently no. The purpose of this module is for people with standalone version of SSP, who would like to utilize it in drupal.

Maybe i the future it will support it, but its currently not on the list.

sansui’s picture

I'm also looking to provide audio, but was trying to figure out how to meet my needs for a slideshow. I have a content type for which there will be a slideshow for every node, so it seemed like it would be a good idea to create a view with SSP that could be embedded and use an argument to serve up the right content. Is this module good for that kind of solution? Would it be better to start from scratch and build a new view for my xml?

sansui’s picture

I created a ssp views, using my own content type with own image field, which works fine. I noticed in the module file that it seems to accomodate audio, so I added the field "field_audio" to my content type and uploaded some audio, but it doesn't include the audio in the output. Any idea?

sansui’s picture

So I've been looking at your module some more to see if I can make an ugly hack to include the audio I need ;D

I'm trying to loop through the views results twice - once to find the audio field, and then print out the audio value, and then the second time to do what you're already doing, printing out the images. I added filefield_widget as a supported field type to your _get_node_field_type function, and changed your check for an image to one for mimetype, but it doesn't seem to work. Even after adding filefield_widget it still only checks the fields that are images.

Edit: Ended up removing filefield_widget, changing code to be much simpler and check for one scenario of the node having field_audio. So now it doesn't break the standard slideshow content type, and my new content type that has the embedded view seems to work fine - pulls in my audio and images.

I'm sure this is a pretty ugly thing, and I'm sure the audio field needs some checks to make sure it's actually an audio file, but it's working for my needs right now. Do you think in the future you could implement audio support for an audio field on a node? :D

function theme_ssp_views_images($view, $op = 0, $args = '') {
  global $base_path;
  $audio_file = $base_path.$node->field_audio[0]['filepath'];
  $audio_caption = $node->field_audio[0]['data']['description'];
  if($args) {
    $args = unserialize(base64_decode($args));
  }
  else {
    $args = array();
  }

  if($audio_file != $base_path) {
    $audio = 'audio="'.$audio_file.'" audioCaption="'.$audio_caption.'"';
  }
  print '<?xml version="1.0" encoding="UTF-8"?>
          <gallery>
           <album id="ssp" title="'.$node->title.'" description="'. strip_tags($node->body).'" '. $audio; // Modified this line to remove the ending bracket so I can move it further down
  $views = views_get_view($view);
  $views->set_arguments($args);
  $views->args = $args;
  $views->preview($op, $args);
  
  //Added copied code here to test for audio field to see if this would work
  $result1 = $views->result;
  foreach($result1 as $node) {
    $node = node_load($node->nid);
    if($node->field_audio['0']) {
            $myaudio = "yes";
            print 'audio="'.$base_path.$node->field_audio['0']['filepath'].'" >';
            break;
    }
  }
  if(!$myaudio) { print ' >'; }
  // end modifications
  
  $result = $views->result;
  $images = array();
  $nodes_seen = array();
  foreach($result as $node) { 
    $node = node_load($node->nid);
    $field = _get_node_field_type($node);
    if($field && !in_array($node->nid, $nodes_seen) && is_array($node->$field)) {
      foreach($node->$field as $image) {
        $src = $base_path.$image['filepath'];
        $description = $image['data']['description'];
        $title = $image['data']['title'];
        $thumbnail = ssp_imagecache_generate('ssp_thumbnail', $image['filepath'], TRUE);
        if(is_array(file_validate_is_image($image))) {
            print '<img src="'. $src .'" title="'. $title .'" caption="'. $description .'" link="" target="_blank" pause="" tn="'.$thumbnail .'" vidpreview="" />' . "\n";
        }

      }
    $nodes_seen[] = $node->nid;
    }
  }
  print '</album></gallery>';
}
chrisck’s picture

Issue summary: View changes
Status: Active » Closed (won't fix)