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

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

|improve this answer|||||
  • Hi Kasper.. Thanks for your prompt reply. Can u please share the code. Have u used any custom vf page to upload the image.. – hellraizer Jul 16 '15 at 11:10
  • 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 Jul 16 '15 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

|improve this answer|||||
-4

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

|improve this answer|||||
  • 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 Jul 16 '15 at 13:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.