1

I have requirement where when images are uploaded in salesforce attachment, the image size or resolution should decrease.So that salesforce won't be overloaded. Can anybody help me out with any approach.

Regards

3 Answers 3

1

Unfortunately Apex does not have any native method of reducing the image size (or any other image transformations).

However, I have just solved the same problem :). I used javascript to change the size of the image in the browser before uploading it to Salesforce. This will work with all modern browsers. I haven't checked if it will work for older browsers.

We use this javascript: https://github.com/viliusle/Hermite-resize

2
  • Hi Kasper.. Thanks for your prompt reply. Can u please share the code. Have u used any custom vf page to upload the image.. Commented Jul 16, 2015 at 11:10
  • 1
    Yes, it requires a custom visualforce page and an apex class. I can't share the code with you since my boss just paid a couple of grand to have the actual coding outsourced. I don't think he'd appreciate me giving it away ;).
    – Kasper
    Commented Jul 16, 2015 at 12:52
0

May be this post will be helpful to you. And more links are available in this post for your reference.

1Resize Image in Photo Upload in Visualforce before save in attachment?

Thanks

-5

Resize the image using third party application Then upload the image as static resource.

1
  • 1
    Attachments aren't uploaded as static resources. Static resources are used for VF pages, not for records. This also doesn't help when an image is being uploaded by a 3rd party or a user who doesn't have access to the utility. The poster is asking for something that can happen in real time on the back-end as files are being uploaded.
    – crmprogdev
    Commented Jul 16, 2015 at 13:32

You must log in to answer this question.

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