I am having some difficulties rendering images. I am using version 6.0.0-SNAPSHOT (downloaded from Github on Monday). I understand this version might not be stable, and may be the cause of the error, but here goes:
In my controller, I use the function “portal.imageUrl({id: component.config.image, scale: ‘scale(1,1)’})” to generate the URL for an image I add to a part. This works fine, generating the following URL: “/admin/portal/preview/draft/my-first-module/templates/test-page//image/ef288075-2f99-4475-ad47-059ed83be827/scale-1-1/penguins.jpg”.
I add this to my model, and insert it as the src for my image tag using data-th-src="${image}". Again, this works as intended, generating the expected markup.
However, the image doesn’t load, and when opening the image URL in a new tab, I get a 500 - Internal Server Error, with a nullpointer in the logs:
“java.lang.NullPointerException: null at com.enonic.xp.portal.impl.resource.image.ImageHandleResource.applyScaling(ImageHandleResource.java:109) ~[na:na]…”
I might be wrong (since I have been away from my desk for some time now), but I don’t think there is any scale filter called “scale”. Try for example “block”, which formerly was known as “scaleblock”.
I had tried scaleblock, etc. before as well, but not with the new names.
‘scale’ was something I believe I found references to a couple of places, but right now I can only find this occurence.
What about when you want the image to be the original size with no scaling? Then you don’t want any scaling, but “scale” is a required parameter. I tried using: