Esta conversación ha sido bloqueada debido a la inactividad. Cree una nueva publicación.
Nivel 1
Nivel 2
Iniciar sesión en la comunidad
Iniciar sesión para ver todas las insignias
Esta conversación ha sido bloqueada debido a la inactividad. Cree una nueva publicación.
I have added reindition in AEM and displaying Image by using this ${properties.fileReference}/jcr:content/renditions/{renditionName}.jpeg Now if i am applying rendition to a particular Image and publishing it is converting to JPEG only how can it work in such a way that when we upload PNG png reindition should come otherwise JPEG should come.
¡Resuelto! Ir a solución.
Vistas
Respuestas
Total de me gusta
Hi @rohankalra you can use javascript use api to check if the resource exist or not.
1. create a js file in same component where your AEM sightly code is.
use below
"use strict";
use(["/libs/wcm/foundation/components/utils/ResourceUtils.js"], function (ResourceUtils) {
var path=this.pngpath;
ResourceUtils.getResource(this.jpegpath)
.then(function (node) {
path = node.path;
});
return path;
});
2. in your sightly code use below code
<sly data-sly-test.jpegpath="${properties.fileReference}/jcr:content/renditions/{renditionName}.jpeg"/>
<sly data-sly-test.pngpath="${properties.fileReference}/jcr:content/renditions/{renditionName}.png"/>
<sly data-sly-use.imagepath="${'example.js' @ jpegpath=jpegpath,pngpath=pngpath}"></sly>
${imagepath.path}
Vistas
Respuestas
Total de me gusta
hello @rohankalra
There must be a way by which you are resolving ${renditionName}. Hopefully its a Sling Model.
You can reuse the same sling model, to generate full path to the rendition and use it as it is in HTL.
- Get asset path from fileReference
- Resolve the desired rendition.
- Use full path in HTL, that is resolved from Model
Just FYI, the Image component already takes case of choosing the best rendition. May be there is a specific reason, why you are resolving it via code.
Vistas
Respuestas
Total de me gusta
The reinditions values are fixed as We are migrating and we are not able to use Image component
Vistas
Respuestas
Total de me gusta
Check this thread on which similar question was asked https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/image-extensions-for-rendi...
let me know if it’s answer your question
Vistas
Respuestas
Total de me gusta
Hi @rohankalra you can use javascript use api to check if the resource exist or not.
1. create a js file in same component where your AEM sightly code is.
use below
"use strict";
use(["/libs/wcm/foundation/components/utils/ResourceUtils.js"], function (ResourceUtils) {
var path=this.pngpath;
ResourceUtils.getResource(this.jpegpath)
.then(function (node) {
path = node.path;
});
return path;
});
2. in your sightly code use below code
<sly data-sly-test.jpegpath="${properties.fileReference}/jcr:content/renditions/{renditionName}.jpeg"/>
<sly data-sly-test.pngpath="${properties.fileReference}/jcr:content/renditions/{renditionName}.png"/>
<sly data-sly-use.imagepath="${'example.js' @ jpegpath=jpegpath,pngpath=pngpath}"></sly>
${imagepath.path}
Vistas
Respuestas
Total de me gusta
Vistas
me gusta
Respuestas
Vistas
me gusta
Respuestas
Vistas
me gusta
Respuestas