Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Renditions of Image Creating in Local But not in Dev Server

Avatar

Level 3

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

1 Accepted Solution

Avatar

Correct answer by
Level 6

Hi @Vishal_Jain03 
why not use OOTB solutions AEM as a Cloud Service (ACS) primarily utilizes Asset Microservices for generating renditions.

  • Navigate to Tools -> Assets -> Processing Profiles.  
  • Create a new profile and specify the desired renditions.
  • Select the assets or folders you want to process.
  • Apply the created processing profile to the selected assets.

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.


View solution in original post

4 Replies

Avatar

Correct answer by
Level 6

Hi @Vishal_Jain03 
why not use OOTB solutions AEM as a Cloud Service (ACS) primarily utilizes Asset Microservices for generating renditions.

  • Navigate to Tools -> Assets -> Processing Profiles.  
  • Create a new profile and specify the desired renditions.
  • Select the assets or folders you want to process.
  • Apply the created processing profile to the selected assets.

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.