You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We missed various PLIPS and other improvements:
- `collective.dexteritytextindexer` merged
- `plone.base`
- modern image scales
- image pre scaling
- responsive image support
- store image scale info in catalog metadata
I am giving a presentation next week and was missing some info. :-)
Within the Plone code base there are circular dependencies.
354
+
Package A uses package B and package B uses package A.
355
+
Specifically, `Products.CMFPlone` is the main package of Plone where everything comes together.
356
+
It depends on a lot of Plone packages.
357
+
But these packages often import code from `Products.CMFPlone`.
358
+
This is done in such a way that it works, but it creates an unclear situation and makes it hard to debug errors when there is an error in this implicit dependency chain.
359
+
360
+
The solution in Plone 6.0 was to create a package called `plone.base`.
361
+
Some often used code from `Products.CMFPlone` and other packages was moved here.
362
+
Backwards compatibility imports were kept in place, so this should not cause any breakage in add-ons.
363
+
You *will* get warnings in your logs, unless you have silenced them.
364
+
For example when your code has `from Products.CMFPlone.utils import base_hasattr` you will see:
365
+
366
+
```
367
+
DeprecationWarning: base_hasattr is deprecated.
368
+
Import from plone.base.utils instead (will be removed in Plone 7)
369
+
```
370
+
371
+
If the add-on only needs to support Plone 6, you can change the code like this:
372
+
373
+
```diff
374
+
- from Products.CMFPlone.utils import base_hasattr
375
+
+ from plone.base.utils import base_hasattr
376
+
```
377
+
378
+
If the add-on needs to support both Plone 5 and 6, this works and avoids the warning:
In Plone 5 this creates a scale of the image, using the Pillow imaging library.
460
+
In Plone 6, the scaled image is not yet created at this point.
461
+
The scaled image is only created when (if) the browser actually requests the image.
462
+
463
+
This is good, because for various reasons, the browser may never actually ask for this scaled image.
464
+
For example, the browser may be on a mobile phone with the images turned off to prevent using costly band width.
465
+
Also, when the tag contains source sets for HiDPI or picture variants, the browser may see five possible images and only choose to download one of them.
466
+
467
+
In Plone 6, when generating a tag for in this case the preview scale, a unique url is generated, and information for this scale is pre-registered.
468
+
Only when the browser requests the scaled image at this url, does Plone generate the scale.
469
+
This avoids generating image scales that never get used.
470
+
471
+
This performance improvement makes two other image improvements possible.
472
+
These follow in the sections directly below.
473
+
474
+
Add-on authors do not *have* to change anything.
475
+
But it is a good idea to check how you are using images, otherwise you miss out on this improvement.
476
+
If you call the `tag` method like above, you are good.
477
+
If you use the `scale` method and then use its `tag` method, then you should change:
0 commit comments