emencia / django-blog-lotus

A weblog application with Django.
https://django-blog-lotus.readthedocs.io/
MIT License
5 stars 1 forks source link

Add smart image feature #11

Closed sveetch closed 1 year ago

sveetch commented 3 years ago

Alike in cmsplugin-block, it would add nice upload fields, image thumbnailer and svg support.

sveetch commented 1 year ago

We will need a library to guess image type for validation so we can either it from Pillow for common image types and switch to something else for SVG.

There are some good packages to guess mime type:

I say, let's start with puremagic, all in all it will have to be tested against various files to see if false positive are rare or not.

Finally, the magic guess library implementation may be flexible enough to switch or enable other solutions if needed.

sveetch commented 1 year ago

We need also something for SVG validation, something simple enough to not require for an heavy library like svglib which stands of reportlab (this is a huge no).

sveetch commented 1 year ago

Features has been ported to a package https://github.com/sveetch/django-smart-media since it may be useful elsewhere.

sveetch commented 1 year ago

Done in 0.5.0 pre-16, will be available in 0.5.0 release yet to come