1

I would like to be able to access both the Video Flash Object, as well as the Video Thumbnail filepath from the Node Display. Please let me know if I can provide more info, not sure anything else is relevant! Thanks!

Clarification: Basically I want to be able to be able to output both the video with a custom resolution, and the thumbnail through an imagecache preset, from either a custom module, or within template.php. Essentially I would hope to end up with both the final video HTML and image HTML as individual objects or php variables, so I can then output them wherever I like from within the relevant node.tpl.php. I'm assuming there's a simple theme() function I can use for both of the above. The embedded video at this time can come from either Youtube/Vimeo.

  • can you explain the context? how would you like to be able to video object and the thumbnail path? do you need it globally, on certain nodes? etc. – zerolab Sep 6 '11 at 12:18
2
+50

One way to do it is to set the video field display mode to full video under /content/types/CONTENT_TYPE/display then add the thumbnail via theme_emvideo_video_thumbnail() as a variable using themename_preprocess_node(&$vars) in your theme's template.php -OR- print it directly in your node.tpl

The trick to theme_emvideo_video_thumbnail(($field, $item, $formatter, $node, $no_link = FALSE, $options = array())) is to provide all the right parameters. Especially $options

e.g.

<?php
  // code adapted from emvideo.theme.inc
  // ignore the <?php tag

  $system_types = _content_type_info();
  $field_name = 'field_video'; // the machine name of your video field

  $field = $system_types['fields'][$field_name];
  $field['widget'] = $system_types['content types'][$node->type]['fields'][$field_name]['widget']; // get CCK widget data. includes all formatting settings

  $options['return_url'] = TRUE; //return URL
  $options['raw'] = TRUE; // return image path. Otherwise node path is returned

  print theme('emvideo_video_thumbnail', $field, $node->{$field_name}[0], 'video_thumbnail', $node, FALSE, $options);

In template.php

<?php
// change MYTHEME with the theme's machine name or use phptemplate
function MYTHEME_preprocess_node(&$vars) {
  if ($vars->type == "mynodetype") {
    // see code above
    $vars->video_thumbnail = theme('emvideo_video_thumbnail'...);
  }
}

Then <?php print $video_thumbnail; ?> where you need it in node.tpl.php (-OR- use the first code block directly in the node template)

Hope it helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.