@datakurre Hi Asko. Yes, I 'know' a bit more. I met Markus (@iham) at the AlpineCitySprint in february where he proposed a sprint topic on image handling in Plone. We discussed a lot of issues, wishes, features with the others participants in Innsbruck @jensens was also involved and I'm forgetting others. We got quite a bit of 'different' features in different area's, itches you don't have in your own projects, but are very valid.
My 'personal' itch to look at image handling (again) is that we have a customer site with 5000 images that have to be auto-focal-point'ed. @mauritsvanrees and I looked at it and the only solution so far is to overwrite @@images and/or create our own @@customimages scaler. One of my idea's was to create a 'dynamic' scale, where I could put "@@images/image_field/autoscale_600x400" in a template, a bit like the placeholder services you find online. (I'll get back to this).
We also discussed thumbor at the alpinecitysprint (https://github.com/thumbor/thumbor). It is a separate image scaling/serving/caching/modification service. It has been developed as the 'external' image inserting service for message boards (globo.com)
Thumbor looks very interesting, but the project was still stuck on Python 2.7 in February and the tickets on github for migration to python 3 seemed stalled. An alternative/replacement mentionned by the Thumbor people in their issues is to switch to Imageflow (https://github.com/imazen/imageflow) but this project doesn's seem to be 1.0ish yet and mainly a library.
I attended the PloneTagung in Dresden in March 9-13th, both Timo and I suggested an Open Space on image handling. We did this on wednesday and it was very well attended. We received nice feedback from developers from the Neos CMS who are already using a 'decoupled' image handling service.
And at the Open Space we found out Thumbor's Python 3 initiative was not dead after all. They released 4 or 5 Python3 alpha's since February
After a general introduction the Open Space focussed a lot on how Thumbor works @jensens gave a good explanation that you have to be very careful with opening up to DDOS-attacks on the image server if you allow external sources to just request any kind of transformation on an image (and that a milion times). The CMS 'signs' a list of non destructive edits, delivers this to the client and the client can use this signed ticket to request the image with only this set of 'scale' parameters from the image server. This is a feature which is necessary for Volto.
This gave me a good slap in the face on my own 'autoscale' idea. Supporting "@@images/image_field/autoscale_600x400" can only be trusted in server side templates, for separate frontend you need the thumbor like solution.
What I have found so far by talking on sprints about image handling is that we have a huge pool of possible improvements and new features and that it is also very easy to cherry pick implementions for you personal or organisational image handling itches that are insufficient or maybe even blocking other functional improvements.
I asked around at the end of the Open Space if end users/editors had more features besides the decoupled image server setup
one of them was better copyright/licensing support in Plone for image material.
Markus main issue we talked about in Innsbruck was the selection of image scales to editors in tinymce. A lot of scales are meant to be used 'hardcoded' in templates or lower level (the social media scales for the og:tags metadata for eample) and you'd like to offer the editor in tinymce only a subset of scales for the wysiwyg text area. Maybe you even want to customise availalbe scales for different rich text fields. (This is traditional Plone, iirc Volto's approach is to have separe Image blocks and not insert images into richtext).
Limit image upload dimensions and/or put validators on the image uploads. Image dimensions or image file was was possible in Arcehtypes but no longer in Dexterity image fields. For this is also some work done already or re-implemented (edit: it is, see list below)
My 'personal' customer projects wish list inside Zest: I want to automatically run a focal point detection after an image is uploaded and I'd like to rip out color profiles, run optipng and/or scale down the 'source' image to max dimensions (a variation on the dimension validator). This all boils down to making the upload phase 'pluggable' with image modifiers.
Focal points: you could do this automatically but a long standing request where we look at CastleCMS all the time is a focal point editor where editors can manually set and optimise their focal point. But why not both
The whole mess of image formats. png, gif, jpg, webp. If you know the frontend you render to support webp, serve the webp version of an image.
svg handling. (this already has improved quite a bit in Plone 5.2)
The past 4-5 years a lot of add'ons have been released that all adress some of these itches. They all tend to get in each others way because the current image handling pipeline isn't extendable enough so that you can safely experiment in your own Plone projects without monkey patching or overriding at specific point in code.
- plone.app.imagecropping (focal point editor where editors can create several crops on the same image)
- colllective.autoscaling (loop over all image fields in your Plone site and scale them down)
- collective.externalimageditor, Products.imageEditor (basic image edit functions for editors)
- medialog.tinymceplugins.imagestyles (add more selectable styles to images)
There also has been work on making image handling more 'pluggable' in the last 12 months:
(plone.namedfile is where the image 'ingress' magic happens nowadays).
We also had the support for HiDPI images added to Plone 5.1, which our former coleague Diederik championned together with @mauritsvanrees (https://github.com/plone/Products.CMFPlone/issues/1483 for the PLIP). A nice side effect/requirement of this PLIP was that all places where images in Plone were inserted had to be changed to using the scale.tag() function so that we can generate html5 source sets and/or make any other kind of html structure around the image pluggable.
But again: this only works in our Server Side Rendered (SSR) traditional Plone setup, and is a dead end in if you want to properly support support 'decoupled' frontends like Volto, then you need a well defined API, handle the security/ddos issues, etc.
Supporting Volto means extending plone.restapi and at least solve some critical issues there are now that a request to plone.restapi triggers the generation of many image scales when only one is needed. @tisto just explained this in the previous post.
It can be tempting to say "noo, this or that feature is not useful or 'wrong', because I/my projects don't need this". And then somebody else describes their setup and in their use case it's a vital part or at least very useful. Reality is that we all have a different subset of requirements for image handling depending on the projects, end users and customers we a dealing with.
Maybe you don't need to downscale images when they are uploaded. You have 'power editors', but my end users are downloading the 6000x5000 images from a company asset management system and insert them 1:1 in a carousel item
Soooo, a lot of information and a large problem space. Current situation:
- Pluggability on image upload/validation has been implemented partially but maybe could be generalised to also support image transformation on upload.
- pluggability on image output is a big theme. We could jump straight to the Ferrari 'external image server' use case/setup as our ideal solution, but that can take quite some time to implement.
- The feature set in 'core' Plone has stagnated for a long time (mainy because of the complexity)
- There is low hanging fruit here in community add'ons and idea's
- A subset of requested features are orthogonal to the upload or delivery phase and are more metadata or editing on the content management level (licensing fields, tinyme integration, focal point editor & storing, exif metadata)
- Volto needs some urgent fixes and improvements in Plone/plone.restapi.
My hope is that if some 'smart' people can look at the current code base and improve
upon the pluggabilty which is already there on the developer level. Then the current image handling in Plone will be the default 'plugins'. Such a re-organisation will make it easier to start experimenting not only with Thumbor but also allows developers to experiment with smaller features at the different stages without directly 'overwriting' or monkey patching.
I still have my 'history of image handling' in Plone write up from February. I can edit it a bit and post here on community.plone.org. I have the impression there are other features and wishes in the community that are not yet visible and I'd like to get more 'world wide' feedback. My intention was to ask around again at PLOG and collect more feedback/organise discussions in Sorrento but we have to switch to online now, which we had to do anyway at some point to get this 'global' community feedback.