Bug found and remedied in core code - missing_movie.png copied as jpg in graphics.php
|
shadlaws
Joined: 2012-03-14
Posts: 175 |
Posted: Wed, 2012-03-28 10:23
|
|||
|
Hey everyone, In debugging my proofsheet module, I discovered a problem with graphics.php, namely in the generate($item) function. The problem is that missing_movie.png is copied as a jpg to the target thumbnails directory. This causes problems if programs expect things that end in jpg to be jpg files. The bug can be found here:
static function generate($item) {
...
if ($input_item->is_movie()) {
// Convert the movie to a JPG first
$output_file = preg_replace("/...$/", "jpg", $output_file);
try {
movie::extract_frame($input_file, $output_file);
} catch (Exception $e) {
// Assuming this is MISSING_FFMPEG for now
copy(MODPATH . "gallery/images/missing_movie.png", $output_file);
}
$working_file = $output_file;
} else {
$working_file = $input_file;
}
...
}
The file missing_movie.png is copied to $output_file, which is predefined with a jpg extension. Whoops. I figure there are two possible solutions:
It seems that the first solution is less likely to break downstream modules than the second solution, and is the one I implemented on my installation. For those interested, I've attached the missing_movie.jpg file you'd need. Sidenote: I've also modified my proofsheet module so it's impervious to the problem by making it determine file type by file header instead of file extension. Thanks,
|
||||

Posts: 25938
Cheers!
I have created https://sourceforge.net/apps/trac/gallery/ticket/1828 so it does not get lost in the forums.
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 214
With the few videos I have, I usually upload my own 200x200 jpg thumbnail image to replace the one that's made. Thanks for pointing that out though.
Thanks,
Mark H.
Using Gallery 3.0.2 - gallery.markheadrick.com
Posts: 175
@floridave - thanks for posting it at sourceforge! Sorry I didn't do it myself... I'm still a bit of a noob as far as gallery management logistics goes. Next time I'll do it myself and spare you the trouble
@MarkRH - aye, it's a pretty minor problem for 99.9% of people, and most things don't care if you feed them mis-extensioned graphic files. It just so happens that FPDF does care, and I hadn't yet made my code robust against it.
Take care,
Shad
Posts: 25938
Fixed: https://github.com/gallery/gallery3/commit/a563dcdfb32d34d4cd22c5c75fa7f02f7b7b08d9
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 175
Sweet - thanks!
Take care,
Shad