• Hi
    We have made a custom solution where we use WooCommerce and an ACF form on a product page. On the product page, a customer can upload an image via the product form. However, we are experiencing some issues during the upload of the image. We just get a timeout or a very slow upload. If we disable Smush, then this problem goes away. Is there something we can do to disable any functionality Smush might be doing during the upload of an image on the frontend? We use this function: acf_upload_file()

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support Nithin – WPMU DEV Support

    (@wpmudevsupport11)

    HI @vayu ,

    You could try to disable the auto compression by using the following action
    remove_action( 'wp_async_wp_generate_attachment_metadata', array( '\Smush\Core\Modules\Smush', 'wp_smush_handle_async' ) );

    So, maybe using the remove_action along with the mentioned ACF function might help. It’s something you’ll have to test and see how it goes.

    I hope this helps in moving forward. Please do let us know how that goes.

    Kind Regards,
    Nithin

    Thread Starter Vayu Robins

    (@vayu)

    Thanks a lot for your suggestion. Unfortunately, it did not work. Any other ideas? 🙂

    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @vayu

    Sorry to hear it didn’t work.

    I pinged our developers to verify if we have any different hook for this.

    We will update once hearing from the developers.

    Best Regards
    Patrick Freitas

    Plugin Support Dimitris – WPMU DEV Support

    (@wpmudev-support6)

    Hello @vayu

    You can use something similar to the following snippet:

    add_filter( 'wp_smush_image', function( $should_smush ){
    	if( $should_smush && ! empty( $_POST['form_id'] ) && $_POST['form_id'] == 671 ){
    		$should_smush = false;
    	}
    	return $should_smush;
    } );

    Keep in mind that we restrict this to one specific form, so we do not affect other forms on the site, so you might need to edit the followings:

    $_POST['form_id']
    $_POST['form_id'] == 671

    to point to your form, as these are for an example using Forminator like this:
    https://share.getcloudapp.com/p9ubyxRD/

    Thank you,
    Dimitris

    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @vayu

    I hope you are doing well and safe!

    We haven’t heard from you in a while, I’ll mark this thread as resolved.

    Feel free to let us know if you have any additional question or problem.

    Best Regards
    Patrick Freitas

    Thread Starter Vayu Robins

    (@vayu)

    I have not been able to test your last code, because we disabled the Smush plugin because of these issues. I have not had time and the client has not requested looking back into this.
    Thanks a lot for your help though. 🙂

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Disable Smush functionality on frontend’ is closed to new replies.