Video thumbnail trouble - Page 2 Video thumbnail trouble - Page 2
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Video thumbnail trouble

Started by Islandtime, November 26, 2004, 06:24:41 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Joachim Müller

just as a rule of thumb: capitalization can cause errors in many ways - to be safe, always use lower case, for folders, files and extensions (what I'm suggesting: it's not a good idea to have upper case letters in an url like http://dauphinislandsurf.com/DISPhoto/ ).

Joachim

bunker

Actually some cameras, at least my Minolta XT, outputs the filenames with capitalized extensions. Would it be possible to get a small patch that allows capitalized extensions for video thumbnails just as it works for pictures with capitalized extensions?

I've tried to figure out the code myself but I just couldn't find the problem  :(

bunker

Ok, so I made a small fix that solves the problem if you have capitalized file extensions AND they are exactly three characters long.

In functions_inc.php I did the following: (the commented line is the original line, the others are the new lines)
$pic_length = strlen($pic_row['filename']);
$pic_extension = substr($pic_row['filename'],$pic_length - 3,$pic_length-1);
               //$file_base_name = str_replace('.'.$mime_content['extension'],'',basename($pic_row['filename']));
               $file_base_name = str_replace('.'.$pic_extension,'',basename($pic_row['filename']));


I think the original problem was that the file extension is assumed to match that given in the mime type, case sensitive.
I'm not sure if it's a good idea to incorporate my fix in a regular release since it assumes three character file extensions so I'm just posting it here for now. Is this ok with the Coppermine license?

bunker

One more thing: I couldn't see the thumbnail for the videos on the thumbnails page. It appears that image dimensions can't be retrieved for videos and they then get set to 0 instead of omitted so the thumb can be displayed. Well, actually the should be calculated from the thumb but I couldn't be bothered so I just fixed the problem with image dimension being set to 0 instead of omitted instead. Here's the hack in functions.inc.php at the end of function compute_img_size:
if (width == 0 && height == 0) {
return '';
}
       return $image_size;

happysnackk

Hello,
I did improve bunkers code a litte with a regular expression which will strip all characters in front of the last "." and the "." itself, leaving only the file extension, no matter how many characters it has.


               $pic_extension = ereg_replace('.*\.','',$pic_row['filename']);
               $file_base_name = str_replace('.'.$pic_extension,'',basename($pic_row['filename']));


Works fine for me!