Hi Everyone,
we are using java backend code to create renditions in AEMAACS the code is working as expected in local but not creating the renditions in Dev Server
please help us to solve this issue
The Code Snippet is as Follows:
public void demoImage(Asset asset, int demoWidth, int demoHeight) {
try {
Layer layer = ImageHelper.createLayer(dataResource);
Layer layer1 = ImageHelper.resize(layer, d, null, null);
File file = new File(FilenameUtils.getName(asset.getName()));
outStream = FileUtils.openOutputStream(file);
layer1.write("image/jpeg", 1.0, outStream);
} catch (Exception e)
{
e.printStackTrace();
}
finally {
IOUtils.closeQuietly(inStream);
IOUtils.closeQuietly(outStream);
log.info("Exiting the resize method for asset: "+asset.getPath());
}
}
@diksha_mishra
@arunpatidar
@aanchal-sikka
Request you to please solve the above issue
Thanks & Regards,
Vishal
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @Vishal_Jain03
why not use OOTB solutions AEM as a Cloud Service (ACS) primarily utilizes Asset Microservices for generating renditions.
now as far as your concern about the code snippet which you provide and since you have not provided any logs, i can see that the code attempts to directly access the file system using new File() and FileUtils.openOutputStream(). This approach won't work in ACS because file system access is restricted in a cloud environment. On your locale it will work.
The code assumes the dataResource variable holds the asset data. In ACS, you should retrieve the desired rendition using Asset API methods instead of relying on a pre-defined dataResource.
Hi @Vishal_Jain03
You need to use Asset Compute service
https://experienceleague.adobe.com/en/docs/asset-compute/using/introduction
Thank you for your reply @arunpatidar
Hi @Vishal_Jain03
why not use OOTB solutions AEM as a Cloud Service (ACS) primarily utilizes Asset Microservices for generating renditions.
now as far as your concern about the code snippet which you provide and since you have not provided any logs, i can see that the code attempts to directly access the file system using new File() and FileUtils.openOutputStream(). This approach won't work in ACS because file system access is restricted in a cloud environment. On your locale it will work.
The code assumes the dataResource variable holds the asset data. In ACS, you should retrieve the desired rendition using Asset API methods instead of relying on a pre-defined dataResource.
Thank you for reply @abhishekanand_
Views
Likes
Replies