How to reduce image size when uploading from parse dashboard

857 Views Asked by At

I am using heroku hosted parse-server and parse-dashboard. Using mongoDb as backend. Using AWS S3 adapter to upload images via parse-dashboard. Is there any way to reduce size of the image when uploading from parse-dashboard to S3?

1

There are 1 best solutions below

2
On

It's possible to do it via cloud code. Write a beforeSave function to catch and resize the image. Please note that if the image is in the Users table you will need to pass useMasterKey:true to modify.

This is done in your main.js file! beforeSave will run when you upload via the dashboard on a specific table.

Here is a post with a cloud function similar to this:

How do I resize a photo into multiple photo sizes before saving in Parse.Cloud.beforeSave

Also you will need to make use of the parse-image module.

https://github.com/parse-server-modules/parse-image