To handle more properly mimetypes, we should allow to add new mimetype/file_extension mapping in any builder.
Those mapping will simplify mimetype determination in manager when file_extension is provided outside of file_path. (file_ext parameter of many manager method).
Those mapping will allow us allow to get easily file_extension from mimetype in builder context (where we have only mimetype and file_path), this may be useful for software that work with file_extension instead of mimetype, like imagemagick.
Original comment:
Note: it's possible to add manually new type to default mimetype list, using a specific mimetype datastore, this allow us to easily guess_extension and/or mimetype from both extension/mimetype:
This may be useful in builder, if we need to obtain extension related to a file with mimetype known but without file_extension in path (currently we do not have "file_extension" parameter in builder, only file_path which need to exist).
this can allow to have specific behavior for builder who really need explicit mimetype. For example with imagemagick builder, we can do, if we get 'arw from mimetype 'image/x-sony-arw' :
To handle more properly mimetypes, we should allow to add new mimetype/file_extension mapping in any builder. Those mapping will simplify mimetype determination in manager when file_extension is provided outside of file_path. (
file_ext
parameter of many manager method). Those mapping will allow us allow to get easily file_extension from mimetype in builder context (where we have only mimetype and file_path), this may be useful for software that work with file_extension instead of mimetype, like imagemagick.Original comment:
Note: it's possible to add manually new type to default mimetype list, using a specific mimetype datastore, this allow us to easily guess_extension and/or mimetype from both extension/mimetype:
This may be useful in builder, if we need to obtain extension related to a file with mimetype known but without file_extension in path (currently we do not have "file_extension" parameter in builder, only file_path which need to exist). this can allow to have specific behavior for builder who really need explicit mimetype. For example with imagemagick builder, we can do, if we get 'arw from mimetype 'image/x-sony-arw' :
convert arw:DSC08523 -layers merge test.jpg
Originally posted by @inkhey in https://github.com/algoo/preview-generator/issues/142#issuecomment-553449301