Expand my Community achievements bar.

Adaptive Image fails when the component copied to /apps from /libs/foundation

Avatar

Level 2

I'm facing weird issue here (Attached app package - Change .jpeg extension to .zip)

I'm trying to use the Adaptive Image component (/libs/foundation/components/adaptiveimage) in my page it resize the image as per specified min-width and the works perfect.

Content : /content/my-app-page/jcr:content/main-par/adaptiveimage (sling:resourceType=foundation/components/adaptiveimage)

fileReference = /content/dam/geometrixx-media/articles/skrillex-bluesfest.jpeg
Image Path : /content/my-app-page/jcr:content/main-par/adaptiveimage.img.620.high.jpeg/1480656487101.jpeg

However when I copy the same component to my app and i'm not making any change (/apps/my-app/components/adaptiveimage) and use the component it fails to works as it always gives me the full width even though i specify different size.

Content : /content/my-app-page/jcr:content/main-par/adaptiveimage (sling:resourceType=my-app/components/adaptiveimage)

fileReference = /content/dam/geometrixx-media/articles/skrillex-bluesfest.jpeg
Image Path : /content/my-app-page/jcr:content/main-par/adaptiveimage.img.620.high.jpeg/1480656487101.jpeg

I can see client-libs are loaded both times. and i dont know why the Adaptive image servlet is not picking and resizing the image even though the image path is same both times  as I don't see any trace in the logs

The momonet i change the property to sling:resourceType=foundation/components/adaptiveimage it works

I'm using AEM 6.2

Am i missing anything here? Any help is much appreciated.

1 Reply

Avatar

Level 2

I think I know the reason.

The AdaptiveImageComponentServlet resource type is set as below, so it will only work when the resource type is foundation adaptive image.

@Property(name = "sling.servlet.resourceTypes", value = "foundation/components/adaptiveimage", propertyPrivate = true)

So in order to make it work I have to either create a servlet which will work for my path (geometrix-common code may help here).

Let me implement it and provide the details here.