I submitted this topic to the "Troubleshooting and Problems" forum 5 days ago, but I guess it was misplaced, it's more like a feature request/bug report. Since nobody replied to that post, I submit it again here. I apologize if this is considered "wrong" behavior.
I've been adding my gallery (Version 3.0.3) with many pictures and videos lately.
I added the file extension "m2ts" to the accepted file extension list of the video module and they got imported
properly, just the preview thumbnail was not displayed at all. But when the video thumbnail was used as the album cover,
it was displayed fine (for the album, not the video file).
I noticed the preview file was given a funny file extension on disk: "mjpg".
Even direct access to this file failed, I guess because it is not in the "allowed_filetypes" format list.
I tracked the problem to these pieces of code:
return preg_replace("/...$/", "jpg", $base);
which can be found in modules/gallery/helpers/graphics.php, line 159, and modules/gallery/models/item.php, lines 191 and 216 .
Since this clearly this assumes a 3-letter file extension, it will produce 'funny' results for any other type.
I changed these occurances to:
$replace = '/' . pathinfo($base, PATHINFO_EXTENSION) . "$/";
return preg_replace( $replace, "jpg", $base);
and now thumbnails with m2ts videos works fine. (Better solutions - substring replacements - are probably possible).
The problem is: The above 3-letter substitution is also found in modules, most notably the video module (videos/models/item.php: lines 191 and 217), probably others too.
Maybe this should therefore be implemented as an independent function, but I'd at least hope this could get changed
for the gallery core.