views - video_embed_field

Video Embed Formatter
Video Embed Formatter - Teaser (video)
Video Embed Formatter - Image - Large (big image from youtube)
Video Embed Formatter - Image - Medium (small image from youtube)
Video Embed Formatter - Image - Small (small image from youtube)

Large, medium and small sizes names are the same that my image styles: admin/config/media/image-styles. But they don't have any relatinship as i see.

Also, Medium size = Small size. Why?

p.d. Sorry for my english.

P.D. is that possible to specify VIDEO size in percent?

for example, 100% x 350px

thanks.

Comments

jec006’s picture

Hey Kervi,

The medium = small thing is a result of youtube only providing 2 sizes while Vimeo provides 3. I think in the future i'll update this a bit.

The formatters right now don't use image styles i don't think - i can add that in - I believe that would be a nice feature.

In terms of the percentage - i think I can add that - will have to look, right now I think it'll break

jdelaune’s picture

We can take the code out of my Vimeo module which allows us to use Image Styles once the images have been copied from their respective sources into the local public directory?

webadpro’s picture

I think being able to use image styles would work a lot better than static image size.

As jdelaune mentioned, copying the big image locally would be a good start then taking our local image and processing it the way we would like to have it, seem like a good idea.

My 2 cents.

jec006’s picture

This seems like a pretty obvious improvement to implement.

I think I'm going to make a 2.x branch and figure out how to get this in there.

dgastudio’s picture

in media_youtube they solving the thumbnail problem with:


  function getOriginalThumbnailPath() {
    $parts = $this->get_parameters();
    return 'http://img.youtube.com/vi/'. check_plain($parts['v']) .'/0.jpg';
  }

  function getLocalThumbnailPath() {
    $parts = $this->get_parameters();
    $local_path = 'public://media-youtube/' . check_plain($parts['v']) . '.jpg';
    if (!file_exists($local_path)) {
      $dirname = drupal_dirname($local_path);
      file_prepare_directory($dirname, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS);
      @copy($this->getOriginalThumbnailPath(), $local_path);
    }
    return $local_path;
  }
}

and the imagecache integration

/**
 * Implements hook_file_formatter_FORMATTER_view().
 */
function media_youtube_file_formatter_image_view($file, $display, $langcode) {
  $scheme = file_uri_scheme($file->uri);
  if ($scheme == 'youtube') {
    $wrapper = file_stream_wrapper_get_instance_by_uri($file->uri);
    $image_style = $display['settings']['image_style'];
    $valid_image_styles = image_style_options(FALSE);
    if (empty($image_style) || !isset($valid_image_styles[$image_style])) {
      $element = array(
        '#theme' => 'image',
        '#path' => $wrapper->getOriginalThumbnailPath(),
      );
    }
    else {
      $element = array(
        '#theme' => 'image_style',
        '#style_name' => $image_style,
        '#path' => $wrapper->getLocalThumbnailPath(),
      );
    }
    return $element;
  }
}

/**
 * Implements hook_file_formatter_FORMATTER_settings().
 */
function media_youtube_file_formatter_image_settings($form, &$form_state, $settings) {
  $element = array();
  $element['image_style'] = array(
    '#title' => t('Image style'),
    '#type' => 'select',
    '#options' => image_style_options(FALSE),
    '#default_value' => $settings['image_style'],
    '#empty_option' => t('None (original image)'),
  );
  return $element;
}

hope it can help.

jec006’s picture

Status: Active » Needs review

Hey Kervi, Thanks for the code snippets, they helped quite a bit.

If you guys checkout the 2.x branch, it now contains full image styles support for thumbnails, along with video_styles, which work in a similar way to control the way the video looks/plays.

It hasn't been heavily tested at all, so please use with caution and report bugs here.

dgastudio’s picture

i have tested the new 2 version and i have found a bug.

in views, everthing in configuration options seems fine.. but in the output, array is printed instead of items.

Array
(
    [video_url] => http://www.youtube.com/watch?v=9FoM2-ibwB4
    [thumbnail_path] => 
    [embed_code] => 
    [description] => Поза вытянутого треугольника
)
dgastudio’s picture

and the thumb contains wrong url

****/sites/default/files/styles/140x100/public

dgastudio’s picture

#7
video_embed_field.field.inc
line 287 - drupal_set_message('

'.print_r($item, true).'

');

jec006’s picture

Hi Kervi,

Good catch, I removed that debugging and it seems to work correctly in views now

webadpro’s picture

I just uploaded the Version2, but in my field settings I can no more set field settings.

Am i the only one?

----

EDIT: Sorry I hadn't seen: admin/config/media/vef_video_styles.

Also, I see that theres some CSS issues here. The Operations are position: absolute but the

tags arent position: relative which makes the absolute div go completely to the right of the screen.

You should add

td.ctools-export-ui-operations {
  position: relative;
}

hope this can help and A+ for the addition of image style. This was a great addon to the module. Congrats.

jec006’s picture

Hi Webpro,

Version 2.x uses Video styles instead - you can configure / create them at /admin/config/media/vef_video_styles

They can be added to features and such also.

webadpro’s picture

Hi,

This is really great.

jec006’s picture

Status: Needs review » Fixed

Awesome, glad you guys like.

Marking this one as fixed

Status: Fixed » Closed (fixed)

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