-
Improvement
-
Resolution: Deferred
-
Minor
-
None
-
2.7.2, 3.1, 3.3.2, 3.3.3, 3.4
-
MOODLE_27_STABLE, MOODLE_31_STABLE, MOODLE_33_STABLE, MOODLE_34_STABLE
If you upload a .bmp file into Moodle (and I'm guessing the same applies to any image filetype that the GD graphics library cannot convert from) then when viewed in the filemanager it is recognized as an image file and a thumbnail is attempted to be generated.
When it fails, it returns instead a hardcoded fallback icon which cannot be overriden by themes, and doesn't take advantage of Moodle's image fallback system to provide SVG, then PNG when not supported.
The hardcoding is on line 2399 of lib/filelib.php:
if (!$preview_file) {
// unable to create a preview of the file, send its default mime icon instead
...
$fileicon = file_file_icon($stored_file, $size);
send_file($CFG->dirroot.'/pix/'.$fileicon.'.png', basename($fileicon).'.png');
The ideal solution would be to recognize that only certain image filetypes can have previews generated for them and to not even try for other image filetypes but instead let the generic icon already provided by the theme remain in use.
Currently if you override the .bmp icon in a theme, when shown in the filepicker it will flash up for a short period of time before being replaced by a "thumbnail" which is actually the default icon.