Skip Navigation

[Resolved] Photo resizing on submission

This thread is resolved. Here is a description of the problem and solution.

Problem: I would like to resize the original images uploaded with Forms, similar to Formidable Forms or resmush.it.

Solution: Forms doesn't have a built-in option for resizing uploaded original images, but if you use Types field shortcodes to display the images it's possible to save various resized images to minimize image file sizes when they are displayed on the front-end of the site.
If you want to validate the image sizes during the file upload process, you can use the Forms API. Similarly, you can use the Forms API to trigger your own custom image resize code.

Relevant Documentation:
https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data
https://toolset.com/documentation/programmer-reference/cred-api/#cred_form_ajax_upload_validate

This support ticket is created 6 years, 4 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Tagged: 

This topic contains 2 replies, has 2 voices.

Last updated by Jon Kay 6 years, 4 months ago.

Assisted by: Christian Cox.

Author
Posts
#1097452

This site will have people submitting photos via CRED. I am concerned about file size. I need photos to be resized as they upload. Does Toolset have a way to photo resize similar to Formidable Forms?

hidden link

Someone else suggested hidden link.

#1097945

Hi, that option isn't built-in to Forms but when you use Types field shortcodes to display those images, you can choose different image sizes. Types then can save those resized images in your library for future use, which will cut down on the file sizes your visitors must download. If you're concerned about space on your server, then this doesn't really help you modify the size of the original image. You would have to use custom code with the Forms API to inspect the image attachments and resize them as needed. We have documentation about this API here: https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data

You could also use the validation API to inspect the image dimensions or filesize and display an error to the User indicating they need to resize the image. We have documentation about this API here: https://toolset.com/documentation/programmer-reference/cred-api/#cred_form_ajax_upload_validate

I can offer assistance with either of those APIs if you would like to try one of these approaches.

#1100875

Thanks. I will follow the links.