6

We have a custom object in our project. Each record has one image, that we want to store on the Amazon S3 bucket. These images are larger size images. So, while saving to Amazon S3 we also want to save thumbnail of the image.

In .net, we can resize an image through Image Handler and save the response to Amazon S3 server.

Is similar thing possible with Apex controller code?

Thanks and Regards,

Ashish Shukla

2 Answers 2

3

https://success.salesforce.com/answers?id=90630000000gui5AAA

Apex does not support this unfortunately .I think you will have to reduce the sizes manually before uploading to S3.

Or find a webservice or third party that does that and that response can be sent to S3.

1
  • Thanks Mohith, we fixed it by using web service. Below is the approach we used.
    – Ashish
    Oct 11, 2014 at 5:17
3

Finally, we fixed this problem mentioned below :

  1. As Salesforce has limited Image processing power, we created a .net web service which takes any public image URL as an input.
  2. This web service will resize the image and upload it to public server (amazon or web server)
  3. Return the resized image path in web service response.

With above, Salesforce 's response and request size will be minimum and image processing and real upload will be done on .net side. It will help us to prevent from SF limits like (response/request limit, heap size limit, etc.).

4
  • nice Ashish .Thanks for sharing back to the website your solution architecture .Thanks Oct 11, 2014 at 5:22
  • 2
    That works, but there is another way. In Visualforce, render the uploaded file into a canvas, rescale the canvas, and then get the content of the canvas and upload the resulting file for use as the thumbnail. I don't have a working example of this at the moment, and of course it only works on modern browsers, but that's something one could look into.
    – sfdcfox
    Oct 11, 2014 at 5:24
  • @ashish shukla can u please share the way to create .net web service which u created. or is there a way to create same kind of service in java
    – Ankuli
    Jul 9, 2015 at 5:59
  • 1
    @Ankuli, we used asp.net service. .Net framework has few classes which helps us to do image processing. Below are few examples, which can help you to create resize service in asp.net : codereview.stackexchange.com/questions/55698/… Another link is : codeproject.com/Tips/550728/…
    – Ashish
    Jul 9, 2015 at 12:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .