I'm listing video nodes in a view. They will only list if the videos have a thumbnail. I can provide a default thumbnail, but then they would all look the same in the view.

The problem is that the proper thumbnail is generated in the transcoding process (zencoder+amazon in my case).

I've specified that only 1 thumb should be generated. When the transcoding is done, I can open the node and save it again. The proper thumb will be shown in the form.

I can't ask my users to edit their node after a while though.

I made a cron job that loaded and saved nodes with thumbnail = 0, but it seems the association between the proper generated thumbnail and video node happens in the GUI... it doesn't work programmatically.

I would really appreciate some help with this. Thanks!

Comments

nzcodarnoc’s picture

Here's what I got to:

function mymodule_generate_thumbnail($node)
{
  // The thumbnails are generated for the edit form view
  $form = drupal_get_form($node->type."_node_form", $node);

  // Get the thumbnail ID
  $language = $form["language"]['#value'];
  foreach ($form['field_myvideofield'][$language][0]['thumbnail']['#options'] as $tid => $value) break;

  // Update the node
  $node->field_myvideofield[$node->language][0]["thumbnail"] = $tid;
  node_save($node);
}

I'm looking at rules at the moment to trigger this function on-successful-encoding.

Jorrit’s picture

After the Zencoder job is finished, the node should be updated to contain a valid thumbnail. This process will be improved in the next version of the module.

Jorrit’s picture

Status: Active » Closed (cannot reproduce)

Closed because of lack of response. Unfortunately, I am unable to investigate the issue using the information you provided. Please try 2.6 or the latest -dev version.