[Solved] Image scale url pointing to local URL in classic-UI

Current image scales in portlets on A News Item — English are broken because of the src pointing to ... where's currently the correct place to file an issue for that?

/cc @MrTango @mauritsvanrees

I think this should be addressed to plone.namedfile. that is the package who lives the browserviews for "@@image_scale" and "@@images"

Which Plone version?

this is coredev on 6-classic.demo.plone.org

The image_scales in the brain contain this:

'icon': {
  'download': '',
  'width': 32,
  'height': 19

We should change the indexer to not contain the full url. And the code using this should then alter the url to have a proper full url again.

I guess @@images/image-32-c685a4c8aa8ec7d51036e84f149cafec.jpeg would be the best url to store. Then code using this can use something like: f"brain.getURL()/data['download']"

Any volunteers?

see Do not use full url in `image_scales` dictionary by petschki · Pull Request #124 · plone/plone.namedfile · GitHub


Zope already has all the conversions, why reinvent the wheel and open the door to future errors? Like every catalog path entry, store the physical path and let Zope do the conversion to the url (_vh_, subsites will be handled correctly in every case, you don't have to remember the logic in the context, etc).

Since the image_scales metadata is only used internally to generate the tags quickly and not a path info for a regular brain, I think it's safe to store only the view name with the scale hash and generate the url in the scaling adapter. By using brain.getURL() in the adapter everything you mentioned should't work without any problems (aka subsites).

1 Like