【问题标题】:AEM - How to upload image programmaticallyAEM - 如何以编程方式上传图像
【发布时间】:2015-03-08 21:59:09
【问题描述】:

我正在尝试在 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.

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

【问题讨论】:

    标签: image upload aem dam


    【解决方案1】:

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

    【讨论】:

      【解决方案2】:
      Asset asset = assetManager.createAsset(damPath, in, dataMimeType, false);
      

      您的dataMimeType 正确吗?例如,应该是"image/jpeg"

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2012-01-04
        • 2011-12-12
        • 1970-01-01
        • 1970-01-01
        • 2021-08-07
        • 2011-06-06
        • 2017-01-28
        • 2011-05-24
        相关资源
        最近更新 更多