We have run into an issue with one of our major integrations that runs every two hours. The system updates nodes with new images when needed. Unfortunately, the renditions get out of sync as this update does not trigger rendition updates. What is the best way to modify this method to trigger the renditions to update?
private Node uploadImageToDam(Session session, String imageUrl, Node node, String imagePath) throws URISyntaxException, IOException, RepositoryException { Node imageNode = getNode(session.getRootNode(), imagePath, "dam:Asset"); imageNode.addMixin("mix:versionable"); Node imageContentNode = getNode(imageNode, "jcr:content", "dam:AssetContent"); // Node relatedNode = getNode(imageContentNode, "related", "nt:unstructured"); Node metadataNode = getNode(imageContentNode, "metadata", "nt:unstructured"); metadataNode.addMixin("cq:Taggable"); Node renditionsNode = getNode(imageContentNode, "renditions", "nt:folder"); Node originalNode = getNode(renditionsNode, "original", "nt:file"); Node dataNode = getNode(originalNode, "jcr:content", "nt:resource"); URI uri = new URI(imageUrl); URLConnection conn = uri.toURL().openConnection(); Binary binary = session.getValueFactory().createBinary(new BufferedInputStream(conn.getInputStream())); String mimeType = conn.getContentType(); if (mimeType.contains(";")) { mimeType = mimeType.substring(0, mimeType.indexOf(";")); } dataNode.setProperty("jcr:data", binary); dataNode.setProperty("jcr:mimeType", mimeType); return imageNode; }
Solved! Go to Solution.
Views
Replies
Total Likes
WHen you upload assets to the DAM - use the AssetManager API. By using the AssetManager API - you automatically get renditions. See this article for details on how to use AssetManager API to place uploaded assets into the DAM.
https://helpx.adobe.com/experience-manager/using/uploading-files-aem1.html
In your example - you are using JCR API - do not use this API to get assets into the Dam.
Views
Replies
Total Likes
WHen you upload assets to the DAM - use the AssetManager API. By using the AssetManager API - you automatically get renditions. See this article for details on how to use AssetManager API to place uploaded assets into the DAM.
https://helpx.adobe.com/experience-manager/using/uploading-files-aem1.html
In your example - you are using JCR API - do not use this API to get assets into the Dam.
Views
Replies
Total Likes
Thanks. We did find that link and tried it quickly, but could not get it to work. We'll revisit when we have more time and refactor to move it the right method.
Views
Replies
Total Likes
Mark - if you want to have a connect session - i can show you this in action.
Views
Replies
Total Likes