2

我正在尝试在 aem 中以编程方式上传图像。它是一个简单的 jpeg 或 png。我尝试手动创建节点,也尝试使用 AssetManager.createAsset。

图像已创建,但工作流程失败。我在 AEM 日志中得到堆栈跟踪(当然这些不是完整的日志,只是标题):

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.

任何想法为什么会发生这种情况?工作流程抛出错误,未创建缩略图,未提取元数据。

4

2 回答 2

2
Asset asset = assetManager.createAsset(damPath, in, dataMimeType, false);

你的对dataMimeType吗?例如,它应该是"image/jpeg"

也可能有用:https ://helpx.adobe.com/experience-manager/using/uploading-files-aem1.html

于 2015-03-13T10:36:44.880 回答
2

您可能缺少jcr:mimeType图像节点上的属性。最好的方法是通过 WebDAV 上传图像并检查由此创建的节点结构。以编程方式复制该结构应该可以工作。

于 2015-03-10T10:08:27.677 回答