Forminator to Image Compression
-
Hi there,
I have a simple form for image upload with a submit button. This enables users to upload images taken with smartphones. However, modern smartphones make for large image files. I want to create a function to intervene prior to saving the image file in the wp-content/uploads folder which will use imagick or GD to resize and compress it. However, when attempting to get this to work, I cannot get the function to fire from the hook/filter. I think I am supposed to use the ‘forminator_custom_form_submit_field_data’ hook but I’m not sure. I also tried ‘wp_handle_upload’ and ‘wp_handle_upload_prefilter’ but those don’t work either. I have code below which should generate a simple output in the error log to test if its working. Maybe I am going about it wrong? I’m not too experienced with coding and stuff. Can please someone help?
function compress_uploaded_image() {
error_log(“compress_uploaded_image hook called.”);
}
add_filter(‘forminator_custom_form_submit_field_data’, ‘compress_uploaded_image’, 10, 4);
The topic ‘Forminator to Image Compression’ is closed to new replies.