downloa image and save to aem programatically code example

Example: downloa image and save to aem programatically

InputStream inputStream = null; try { inputStream = getInputStream(downloadUrl); if (is.available() > 0) { Resource resource = resourceResolver.resolve(documentNode.getPath()); Asset asset = DamUtil.resolveToAsset(resource); if (asset != null) { asset.addRendition("original", inputStream, mimeType); session.save(); } inputStream.close(); } } catch (IOException io) { log.info(":::::=============== IOException ===============:::::"); log.info("-------------------> Exception ==> {}", io.getMessage()); io.printStackTrace(); }

Tags:

Php Example