Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: 1 [2]   Go Down

Author Topic: Video thumbnail trouble  (Read 9688 times)

0 Members and 1 Guest are viewing this topic.

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Video thumbnail trouble
« Reply #20 on: December 13, 2004, 08:26:45 am »

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
Logged

bunker

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Re: Video thumbnail trouble
« Reply #21 on: March 26, 2005, 12:04:06 pm »

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  :(
Logged

bunker

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Re: Video thumbnail trouble
« Reply #22 on: March 27, 2005, 04:05:08 pm »

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)
Code: [Select]
$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?
Logged

bunker

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Re: Video thumbnail trouble
« Reply #23 on: March 27, 2005, 04:48:03 pm »

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:
Code: [Select]
if (width == 0 && height == 0) {
return '';
}
        return $image_size;
Logged

happysnackk

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Re: Video thumbnail trouble
« Reply #24 on: May 28, 2005, 04:07:04 pm »

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.

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

Works fine for me!
               
Logged
Pages: 1 [2]   Go Up
 

Page created in 0.019 seconds with 15 queries.