mardi 10 mars 2015

AEM - How to upload image programmatically

I'm trying to upload an image programmatically in aem. It is a simple jpeg, or png. I tried to create node by hand and I also tried using AssetManager.createAsset.


Image was created but workflows has failed. I get stacktraces in AEM logs (of course those are not full logs, just headers):



com.day.cq.dam.commons.handler.StandardImageHandler getImage: error while reading image at path
com.day.cq.dam.commons.handler.StandardImageHandler failed to extract image using Layer will try the fallback
javax.imageio.IIOException: No decoder available to load the image
com.day.cq.dam.core.impl.gfx.CommonsGfxRenderer gfx: cannot get image for asset
com.day.cq.dam.commons.handler.StandardImageHandler getImage: error while reading image at path [/content/dam/path/to/image/original]:
org.apache.commons.imaging.ImageReadException: Can't parse this format.


Any ideas why this is happening? Workflows throws errors, thumbnails are not created, metadata are not extracted.


1 commentaire: