Renditions of Image Creating in Local But not in Dev Server | Adobe Higher Education
Skip to main content
Level 3
July 26, 2024
해결됨

Renditions of Image Creating in Local But not in Dev Server

  • July 26, 2024
  • 2 답변들
  • 828 조회

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

이 주제는 답변이 닫혔습니다.
최고의 답변: abhishekanand_

Hi @vishal33 
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.


2 답변

arunpatidar
Community Advisor
Community Advisor
July 26, 2024
Arun Patidar
Vishal33작성자
Level 3
July 27, 2024

Thank you for your reply @arunpatidar 

abhishekanand_
Community Advisor
Community Advisor
July 26, 2024

Hi @vishal33 
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.


Abhishek Anand
Vishal33작성자
Level 3
July 27, 2024

Thank you for reply @abhishekanand_