Flashvars are not respecting CCK thumbnail field settings
greg.harvey - May 27, 2009 - 12:06
| Project: | FlashVideo |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | reviewed & tested by the community |
Description
If the user specifies they want the video thumbnail as the intro page to a video, it doesn't check to see if there is a CCK field set for containing the thumbnail. It simply assumes the thumbnail is in the same directory as the video, which is not necessarily the case. I noticed this because of a 404 I kept seeing. Turns out the player was trying to load an non-existent thumbnail.
See line 416 of flashvideo.module:
<?php
// Determine the intro image for the video.
if (!isset($video['flashvars']['image']) && (strpos($flashvars, 'image') === FALSE)) {
// If it is a playlist or if they do not want the thumbnail to be used as the intro image.
if ($playlist || (flashvideo_variable_get($video['node_type'], 'introthumb', 1) == 0)) {
// Make sure that the introimg variable is actually valid.
if (flashvideo_variable_get($video['node_type'], 'introimg', '') != '') {
// Set up the intro image as what they specified in the "introimg" user variable.
$video['flashvars']['image'] = check_url(file_create_url($output_dir . flashvideo_variable_get($video['node_type'], 'introimg', '')));
}
}
else {
// They want to use the video thumbnail as the intro image.
$video['flashvars']['image'] = check_url(preg_replace("/\.flv|\.mp4/", ".jpg", $video['file']));
}
}
?>Right near the end there it needs some logic to see if a CCK field has been specified and, if so, get the path info for the thumbnail from that CCK field. Bit pressed for time, so won't be able to do a patch right now cos it's not critical to me, but flagging the issue. =)

#1
I've been looking into this today and am wondering what the general feeling is about taking thumbnails as video metadata? It's as valid an element to most users as width and height surely? My point being that it's easy to add;
$video['thumbnail'] = flashvideo_get_thumbnail($node, $params, TRUE); // TRUE to fetch path onlyInto the function, flashvideo_get_video_object. This has the added benefit of returning the thumb path regardless of where it comes from as its reusing an existing module hook (which in itself calls a handy module_invoke_all('flashvideo_get_file',...) for customisations)
Thoughts?
Pobster
#2
Okay so here's a patch to show what I'm thinking... Use it on current 6.x-1.x-dev - I like it, it's simple and avoids this second-guessing method currently implemented.
Just to note; there's no need to pass $video['thumbnail'] through check_url as the flashvideo_get_thumbnail function does this already.
Pobster
#3
I applied the patch... no change.
Perhaps I'm using the module incorrectly. I just added
teaser template:
<?phpprint $teaser
?>
[thumbnail]
body template:
<?phpprint $body
?>
[video]
and after converting the video, the teaser shows and when clicked, plays the video. All of these videos are now broken after the update to Drupal 6. I can add new videos and the new ones display correctly and play.
Broken example: http://beaverton.nwresd.org/blogs613/?q=node/622
Working example: http://beaverton.nwresd.org/blogs613/?q=node/244
;-) Paul
#4
I can confirm the patch in http://drupal.org/node/474154#comment-1907198 works, it solved my problem of flash player image not showing the thumbnail because the thumbnail is not saved in the same dir as video.
#5
I really like this patch so I'm marking it as reviewed by the community to get the attention of the module authors.
Thanks,
Pobster
#6
I like the idea of separate folders for thumbnails, video, etc. so subscribing.