Hi,
i have a block made by view (i try table view and list view both) and i have choose two fields:

Node: Title
Video: Thumbnail

but the thumbnail doesn't show !!!! :(
Instead in full node i see the thumbnail correctly.
Help me,
please!!

Max

Comments

psicomante’s picture

In the next, i suggest Fabio to use Image_attach for thumbnailing Support

capitano83’s picture

fabio says me to post the html generated by block.

it's this:

Canto Chart


Audio 1

80% admin
audio 2

60% admin

capitano83’s picture

Sorry for my previous post...it's the first time tath i post code.
retry......

<h2>Canto Chart</h2>

  <div class="content"><div class='view view-canto-chart'><div class='view-content view-content-canto-chart'><table>
 <thead><tr><th class="view-cell-header view-field-node-title"></th><th class="view-cell-header view-field-video-video-image"></th><th class="view-cell-header view-field-jrating-votingapi-cache-value"></th><th class="view-cell-header view-field-votingapi-cache-vote-percent-average-value"></th><th class="view-cell-header view-field-users-name"></th> </tr></thead>
<tbody>
 <tr class="odd"><td class="view-field view-field-node-title"><a href="/?q=node/29">Audio 1</a></td><td class="view-field view-field-video-video-image"></td><td class="view-field view-field-jrating-votingapi-cache-value"><span class="rating" id="rating-mean-29"><div class="star avg on"><a style="width: 100%;" onclick="return false;">&nbsp;</a></div>
<div class="star avg on"><a style="width: 100%;" onclick="return false;">&nbsp;</a></div>
<div class="star avg on"><a style="width: 100%;" onclick="return false;">&nbsp;</a></div>
<div class="star avg on"><a style="width: 100%;" onclick="return false;">&nbsp;</a></div>
<div class="star avg"><a style="width: 100%;" onclick="return false;">&nbsp;</a></div></span></td><td class="view-field view-field-votingapi-cache-vote-percent-average-value">80%</td><td class="view-field view-field-users-name">admin</td> </tr>
 <tr class="even"><td class="view-field view-field-node-title"><a href="/?q=node/34">audio 2</a></td><td class="view-field view-field-video-video-image"></td><td class="view-field view-field-jrating-votingapi-cache-value"><span class="rating" id="rating-mean-34"><div class="star avg on"><a style="width: 100%;" onclick="return false;">&nbsp;</a></div>
<div class="star avg on"><a style="width: 100%;" onclick="return false;">&nbsp;</a></div>
<div class="star avg on"><a style="width: 100%;" onclick="return false;">&nbsp;</a></div>
<div class="star avg"><a style="width: 100%;" onclick="return false;">&nbsp;</a></div>
<div class="star avg"><a style="width: 100%;" onclick="return false;">&nbsp;</a></div></span></td><td class="view-field view-field-votingapi-cache-vote-percent-average-value">60%</td><td class="view-field view-field-users-name">admin</td> </tr>
</tbody></table>
</div></div>
</div>
</div>
<div id="block-views-danza_chart" class="clear-block block block-views">
drumminlogan’s picture

I am having the same problem. Any idea as to what can fix this problem?

omar’s picture

I am experiencing the same issue.

Dawa’s picture

Nobody can't tell ??

rubenk’s picture

Wow. I was just about to post a new node about this.

I can't seem to get a simple thumbnail block with a "latest video" block view.

What do you mean by

full node i see the thumbnail correctly

?

Do you think it would be easier for me to check the php written for the block itself to show the image rather than the title of the video.

Dawa’s picture

Hi all,

The problem is that you have to serialize data to get the path image. and I can't do that with view ... too bad !

So, I wrote few PHP code to paste in a block. It list the 5 last videos published and display thumbnail and title with link.
I'ts not perfect but it works :

<?php

$result = db_query("SELECT n.nid, n.title, n.created, v.vid, v.serialized_data FROM {node} n INNER JOIN {video} v ON n.vid = v.vid WHERE n.type = 'video' AND n.status = 1 ORDER BY n.created DESC");

for ($i = 1; $i <= 5; $i++) {

   $node = db_fetch_object($result);
   $video = video_load($node);
   $image = node_load(array('nid'=>$video->serial_data['iid']));      
   $video->iid = $video->serial_data['iid'] = $image->nid;

  if ($video->iid) {
      $output = theme('video_image_teaser', $video);
      $output .= l($node->title, "node/$node->nid", array(), NULL, NULL, FALSE, TRUE);
      print $output . "<br>";
  }
  
}
?>

Hope it help you.
Dawa

theorichel’s picture

Dawa please could you be more specific WHERE this snippet should be pasted?

Many many thanks,

Theo Richel

theorichel’s picture

And also: are there tablenames in this code that I should give my own prefix?

theorichel’s picture

I have pasted the code in the block-configuration box and I gave both 'node' and ' video' tablenames my prefix. That was apparently wrong (it made clear that the prefixes were already added). When I removed these prefixes I got no errors anymore, but I also do not see the thumbnails at www.klimatosoof.nl (lower right). Or should I paste it somewhere else?

Thanks

mattso5050’s picture

Excellent! Nice work.

Can you help me randomize the videos so it doesnt show in order of submission?

Thanks,

Matt

Dawa’s picture

Hi theo,

- Yes, you can paste this code in PHP block or a PHP page.

- You don't have to change the table names. Drupal do his job with {node} and {video}.

- You say "I also do not see thumbnails" ...but... are title displayed with the link ?

Dawa

jorisx’s picture

wow this works really well,
is it possible to get a list of video's with a certain tag?

like // tag to use:
$tag = 'personalVideo';

but I'm not sure where to put the $tag in the db query ?

seaneffel’s picture

You guys are doing a lot of custom coding and block snippets when a better, code free way of doing this is with the Views module. Video plays nicely with Views, we have multiple pages and blocks based on tags from video nodes using the logic already built into Views. Look here on the right side column:

http://www.cctvcambridge.org

Hope this helps, no need to bang your head on the screen for solutions when its already been done for you.

superlou’s picture

Hi Seaneffel,

That list of videos with thumbnails looks exactly what (I think) many of us our trying to do using vanilla views. Could you give us an idea of how you displayed the thumbnail, since when we try simply exposing the video thumbnail view, nothing is output?

Thanks,
Louis

seaneffel’s picture

I'm actually not at my work machine to answer this properly but here is what I did, in a tiny nutshell.

Effectively I made a normal full node list page view, and the part you are trying to do is a table block view of the same criteria. I made sure that all the fields I wanted were enabled in the view - thumbnail, author, title, time, etc.

I used the Views theme wizard to generate a custom tpl.php file for my View. The wizard gives you two sets of code, one destined for its own theme viewname.tpl.php file and one that is meant to be attached to the bottom of your template.php file. Read the notes carefully in the wizard then you'll see that the wizard generates a default custom theme file for lists (I am using a table view so I had to change my varables in the part meant for the template.php file).

I then tweaked the new viewname.tpl.php file until I got the design I wanted. If you want more explanation then let me know and a few days when I am back at work I can punch up samples of the theme template.php and viewname.tpl.php files I made.

seaneffel’s picture

Here are the two sample files for you to look at. These theme files were generated with the views theme wizard and then tweaked by hand to get the layout I wanted. This view was created to show a table display of all videos tagged with "webchannel" and the fields for video thumbnail, author, creation date, play time, play link, etc, were all enabled in the view logic.

The first example is the code in my stand-alone tpl.php file, named views-table-webchannel.tpl.php. The second is a section that was added to the theme template.php file. Both files are found in the active theme directory.

views-table-webchannel.tpl.php


<?php 
/**
 * views template to output one 'row' of a view.
 * This code was generated by the views theming wizard
 * Date: 6/1/2007
 * View: videos
 *
 * This function goes in your views-table-webchannel.tpl.php file
 */


<tr><td>
<?php print $video_image; ?>
</td></tr>
<tr><td><?php print $title?><br>
<small>
<?php print $name?> - 
<?php print $created?> - 
<?php print $playtime_seconds?> - 
<?php print $play_link?>
</small>
</td></tr>

?>

template.php


<?php

/** ===================================================================
 * Date: June 1, 2007 - 11:26am
 * View: webchannel
 */
 
function phptemplate_views_view_table_webchannel($view, $nodes, $type) {
  $fields = _views_get_fields();

  $taken = array();

  // Set up the fields in nicely named chunks.
  foreach ($view->field as $id => $field) {
    $field_name = $field['field'];
    if (isset($taken[$field_name])) {
      $field_name = $field['queryname'];
    }
    $taken[$field_name] = true;
    $field_names[$id] = $field_name;
  }

  // Set up some variables that won't change.
  $base_vars = array(
    'view' => $view,
    'view_type' => $type,
  );

  foreach ($nodes as $i => $node) {
    $vars = $base_vars;
    $vars['node'] = $node;
    $vars['count'] = $i;
    $vars['stripe'] = $i % 2 ? 'even' : 'odd';
    foreach ($view->field as $id => $field) {
      $name = $field_names[$id];
      $vars[$name] = views_theme_field('views_handle_field', $field['queryname'], $fields, $field, $node, $view);
      if (isset($field['label'])) {
        $vars[$name . '_label'] = $field['label'];
      }
    }
    $items[] = _phptemplate_callback('views-table-webchannel', $vars);
  }
  if ($items) {
    return theme('table', $items);
  }
}
?>

amnion’s picture

So, question--I'm no good at php but I could use the two snippets above and just change the name from view-tables-webchannel to whatever, yes?

seaneffel’s picture

Yes, and I don't speak PHP either and I manage to figure it out as well. If you want to use these two snippets just note what file they are supposed to reside in by looking at the file name above each snip. Then be sure that you change each instance of theme naming, in the second snippet there are two instances of my custom view name (views-table-webchannel and views_table_webchannel, note the - vs _ ). Also note that these snippets require the view to be set to a table type, not a list type, as the naming suggests.

Try it, you'll like it.

amnion’s picture

[quote]You guys are doing a lot of custom coding and block snippets when a better, code free way of doing this is with the Views module. Video plays nicely with Views, we have multiple pages and blocks based on tags from video nodes using the logic already built into Views. Look here on the right side column:

http://www.cctvcambridge.org

Hope this helps, no need to bang your head on the screen for solutions when its already been done for you.[/quote]

How did you do this?

oskar_calvo’s picture

I have found this node: http://drupal.org/node/246400

It tells how to get a video thumbnails in a block with Embedded Media Field configuration.

Oskar

hypertext200’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.