algoo / preview-generator

generates previews of files with cache management
https://pypi.org/project/preview-generator/
MIT License
235 stars 51 forks source link

better imagemagick supported mime list to avoid error with builder #153

Closed inkhey closed 4 years ago

inkhey commented 4 years ago

related to #118, #113, #115, #116, #117, #134

Remove support for pdf,text file, svg and other non-image file support for imagemagick/wand by having a better imagemagick supported type list

:warning: recheck all file_extension "supported by imagemagick" to check if some mimetype are missing (file_extension supported but no correct match to mimetype) see https://github.com/algoo/preview-generator/issues/157

inkhey commented 4 years ago

note: we need to check each file_extension imagemagick support "theorically" to add proper mimetype ( and add custom one ?), this way we can reactivate support for new format.

JulienPalard commented 4 years ago

I'm not a fan of having builder specific code in utils.py, I don't feel the move is needed.

But it looks like a good idea to try to make imagemagick output a correct list of supported mimetypes. I think you can also remove text/plain (see https://github.com/algoo/preview-generator/issues/118), it would probably close many issues in the range 113-118, if not all.

JulienPalard commented 4 years ago

I rebased on top of #155 and applyed my randomization patch from #113, and it looks like this PR helps a lot!

inkhey commented 4 years ago

I'm not a fan of having builder specific code in utils.py, I don't feel the move is needed.

The problem is that the code used there is for both IM and wand builder, so we need to put this in a common space.

But it looks like a good idea to try to make imagemagick output a correct list of supported mimetypes. I think you can also remove text/plain (see #118), it would probably close many issues in the range 113-118, if not all.

all "text/" mimetype are removed by default, including text/plain.

Note: there is also some file type that imagemagick does support that we do not support yet because of mimetype issue (see https://github.com/algoo/preview-generator/issues/157).