Problem/Motivation

imagecache_token_tokens() generates an error "Attempted to parse an ill-formed url: youtube://styles/large/youtube/v/abcdefg" followed by a php notice "Notice : Trying to access array offset on value of type bool dans imagecache_token_tokens() (line 181..."
This is because this function calls image_get_info($styled_uri) which returns FALSE in case we don't deal with an image. $styled_uri is generated by a call to image_style_path() inside imagecache_token_tokens(). From Drupal API doc:

function image_get_info($filepath, $toolkit = FALSE) {
  $details = FALSE;
  if (!is_file($filepath) && !is_uploaded_file($filepath)) {
    return $details;
  }

Then lines like $output[] = $images_style_data[$styled_uri]['width']; fail because $styled_uri (who's value is now FALSE) is no more an array.

Steps to reproduce

A node with an entity file field (media 2) and a mix of real images and external videos like youtube, vimeo, etc.

Proposed resolution

No idea. For a temporary solution I skipped processing of video tokens by imagecache_token_tokens() by setting a test if (preg_match('/^video\//', $field['filemime'])) continue; then I create those metatags getting
$image_render_array = media_youtube_file_formatter_image_view($file, $display, LANGUAGE_NONE);
before a call to image_style_url($image_render_array['#style_name'], $image_render_array['#path']);
This way I get the path to a styled thumbnail of my video.

Remaining tasks

User interface changes

API changes

Data model changes

Comments

erwangel created an issue.