Hi,
I modify the media_vimeo.formatters.inc to add a "Show as URL" checkbox to the Vimeo Preview Image formatter in order to get the image url in my views. Here's what I did:

    $formatters['media_vimeo_image'] = array(
    'label' => t('Vimeo Preview Image'),
    'file types' => array('video'),
    'default settings' => array(
      'image_style' => '',
      'show_as_url' => '',
    ),
    'view callback' => 'media_vimeo_file_formatter_image_view',
    'settings callback' => 'media_vimeo_file_formatter_image_settings',
  );  
/**
 * Implements hook_file_formatter_FORMATTER_view().
 */
function media_vimeo_file_formatter_image_view($file, $display, $langcode) {
  $scheme = file_uri_scheme($file->uri);
  if ($scheme == 'vimeo') {
    $wrapper = file_stream_wrapper_get_instance_by_uri($file->uri);
    $image_style = $display['settings']['image_style'];
    $valid_image_styles = image_style_options(FALSE);
    $show_as_url = $display['settings']['show_as_url'];
    if ($show_as_url) {
		if (empty($image_style) || !isset($valid_image_styles[$image_style])) {
			$ouput = $wrapper->getOriginalThumbnailPath();
		} else {
			$output = image_style_url($image_style,$wrapper->getLocalThumbnailPath());
		}
		$element = array(
			'#type' => 'markup',
			'#markup' => $output,
		);
	} else {
		if (empty($image_style) || !isset($valid_image_styles[$image_style])) {
		  $element = array(
			'#theme' => 'image',
			'#path' => $wrapper->getOriginalThumbnailPath(),
			'#alt' => $file->filename,
		  );
		}
		else {
		  $element = array(
			'#theme' => 'image_style',
			'#style_name' => $image_style,
			'#path' => $wrapper->getLocalThumbnailPath(),
			'#alt' => $file->filename,
		  );
		}
	}
    return $element;
  }
}

/**
 * Implements hook_file_formatter_FORMATTER_settings().
 */
function media_vimeo_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)'),
  );
  $element['show_as_url'] = array(
    '#title' => t('Show as URL'),
    '#type' => 'checkbox',
    '#default_value' => false
  );
  return $element;
}

2 problems:
The "Show as URL" option isn't saved.
The url I get is something like "http://styles/img_pano_80_80/http/b.vimeocdn.com/ts/187/551/187551494_64..." and not an external url

Anyone can help me solving this?

Comments

RumpledElf’s picture

I've hit this too and am surprised it isn't already an option. Will make a module that adds this view mode and link it back here.

leksat’s picture

rob c’s picture

Euuh folks, what about this?

http://drupal.org/project/file_entity_link

devin carlson’s picture

Category: Feature request » Support request
Status: Active » Fixed

You can accomplish this by rendering the video using the "URL to file" formatter provided by the core File module.

Status: Fixed » Closed (fixed)

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

brightbold’s picture

Status: Closed (fixed) » Active

Unless I'm fundamentally misunderstanding something here, the "URL to file" formatter is not helpful, because it provides a URL to the video itself, and what we're looking for is a URL to the video preview image. I can select either "URL to file" as the formatter or "Rendered file" as the formatter with "Preview" as the view mode, but I don't see any way (other than the sandbox modules posted above) to get the URL to the preview image.