function video_thumbnails_cron() { // Query for all nodes that have the uploaded video paragraph type and do not yet have a thumbnail set. $query = new EntityFieldQuery(); $query->entityCondition('entity_type', 'node') ->fieldCondition('field_mg_paragraph', 'paragraphs_type', 'mg_parag_video') ->fieldIsNull('field_mg_field_image'); $result = $query->execute(); if (!empty($result['node'])) { $nids = array_keys($result['node']); $batch_size = 5; // Set the batch size to process 5 nodes at a time. $total_batches = ceil(count($nids) / $batch_size); for ($batch = 0; $batch < $total_batches; $batch++) { $offset = $batch * $batch_size; $batch_nids = array_slice($nids, $offset, $batch_size); $batch_operations = array(); foreach ($batch_nids as $nid) { $batch_operations[] = array('video_thumbnails_process_node', array($nid)); } $batch = array( 'operations' => $batch_operations, 'finished' => 'video_thumbnails_batch_finished', 'title' => t('Processing video thumbnails'), 'init_message' => t('Starting processing video thumbnails.'), 'progress_message' => t('Processed @current out of @total nodes.'), 'error_message' => t('An error occurred while processing video thumbnails.'), 'progressive' => FALSE, ); batch_set($batch); } } } function video_thumbnails_process_node($nid, &$context) { // Get the node object. $node = node_load($nid); // Get the uploaded video paragraph from the node. $paragraphs = field_get_items('node', $node, 'field_mg_paragraph'); $mg_parag_video_paragraph = null; foreach ($paragraphs as $paragraph) { if ($paragraph['paragraphs_type'] == 'mg_parag_video') { $mg_parag_video_paragraph = $paragraph; break; } } if (!$mg_parag_video_paragraph) { return; } // Get the file path for the uploaded video. $video_file = file_load($mg_parag_video_paragraph['file_id']); $video_file_path = $video_file->uri; // Generate a thumbnail image for the video using FFMPEG. $thumbnail_file_path = // Use FFMPEG to generate thumbnail image for $video_file_path. // Save the thumbnail image as a file in Drupal's public files directory. $thumbnail_file = file_save_data(file_get_contents($thumbnail_file_path), 'public://' . basename($thumbnail_file_path)); if ($thumbnail_file) { // Set the mg_field_image field for the node to point to the generated thumbnail file. $node->field_mg_field_image[LANGUAGE_NONE][0]['fid'] = $thumbnail_file->fid; field_attach_update('node', $node); } $context['results'][] = $nid; } function video_thumbnails_batch_finished($success, $results, $operations) { if ($success) { $message = t('Video thumbnails processing has completed successfully.'); drupal_set_message($message); } else { $message = t('Video thumbnails processing has completed with errors.'); drupal_set_message($message, 'error'); } } NY Times: A Consumer’s Spot for Apple Grows Up Adland®

NY Times: A Consumer’s Spot for Apple Grows Up

Here's a homemade Apple ad that's so good, Lee Clow came calling.

Click read more to view the final produced version (airing now on TV).

Adland® is supported by your donations alone. You can help us out by buying us a Ko-Fi coffee.
Anonymous Adgrunt's picture
comment_node_story
Files must be less than 1 MB.
Allowed file types: jpg jpeg gif png wav avi mpeg mpg mov rm flv wmv 3gp mp4 m4v.
Dabitch's picture

So, they edited out the Mac+PC thing?

caffeinegoddess's picture

Demo love.

Dabitch's picture

Ha!!

kamari's picture

The spot, while "good", was never anything but a typical standard reply to the brief, saying everything that is in the brief. Which frankly, makes it really bad.

The real talent lies that the guy wrote his own brief. It means apple fans know apple better than any suit or planner. Talk about love mark.

Does anyone have a QT of these please? The first youtube one keeps cutting out on me.

//* */