It's not possible to scale image links

Enonic version: 7.2.0
OS: Ubuntu 18.04

I was looking here HtmlLinkProcessor.java to understand how it’s working, but it seems it’s pretty strange that it’s allowing me just to specify aspect ratio and nothing else.
For example: image://6c8e936c-927e-460d-afb9-7bc44d5982ab?scale=4:1

Check it out:

<figure class="captioned editor-align-right" style="float: right;"><a class="fancy" href="media://download/6c8e936c-927e-460d-afb9-7bc44d5982ab" title="Fiskeridirektør Liv Holmefjord med Bryggen i Bergen i bakgrunnen. Foto: © Anette Aase / Fiskeridirektoratet"><img alt="liv-holmefjord-bryggen.jpg.jpg" data-src="image://6c8e936c-927e-460d-afb9-7bc44d5982ab?scale=4:1" src="/admin/rest/cms/default/base/content/image/6c8e936c-927e-460d-afb9-7bc44d5982ab?ts=1602113421748&amp;size=768&amp;scaleWidth=true&amp;scale=4:1" /></a>
<figcaption></figcaption>
</figure>

If I have a HTML code like that I can resize the resulting image on backend. But I wasn’t able to specify any other scaling method, like width(300), height(100) or max(500), etc.

When I try anything else than aspect ratio, I get this on content studio:

Let me ask: Was that a bug or just a missing feature?

[EDIT]
Another thing I just found is that all images (even images smaller than 768 of width) gets resized using the scaling width(768) when rendered from image links. I just wonder: Why :thinking:?
To solve that I have to put ?keepSize=true on all image links, like this example:
image://6c8e936c-927e-460d-afb9-7bc44d5982ab?keepSize=true


@tsi
@ase
@jsi

First of all, what you see in the editor source code is irrelevant. However, the output from processHtml is.

That said, images are currently fixed to w768, and that is indeed a limitation/missing feature.

The plan is to allow specifying å desired range of image sizes when invoking processHtml.

I’m convering this to a feature request.

1 Like

We have added this to our roadmap. Hope to fix it this year.

Solution will support image source sets.

Regards,
Morten

1 Like