Support » Plugin: Formidable Forms - Contact Form, Survey, Quiz, Calculator & Custom Form Builder » Function to disable making multiple images

  • Resolved neotrope

    (@neotrope)


    Hi, folks
    looking for help to add a function to our site where we have Formidable working with WooCommerce Storefront. If somebody uploads an image file, we get whole slew of image sizes created beyond original image (e.g., 1300×600 jpg). Looking for hook or code to disable that in some way since only image additions are from Forminable.

    Thanks. 🙂

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support Njones35

    (@njones35)

    Hi @neotrope

    Unfortunately, there is no way to tell WordPress to treat Formidable uploads any differently from normal image uploads. The WordPress settings for this are global, so disabling the extra image sizes is a sitewide change.

    This guide shows how to remove unwanted image sizes though – you could possibly adjust this so WordPress creates less additional images? https://quadlayers.com/remove-wordpress-default-image-sizes/

    Best,

    Thread Starter neotrope

    (@neotrope)

    Thanks. Trying to disable all sitewide thumbnails. I had already disabled the default thumbs that wordpress does. However, seems like three proportional thumbs still being built by Storefront/WooCommerce, possibly gallery images, and trying to find a code snippet to quash those last 3 (still better than 7!).

    Solutions I keep finding are for a bad behavior plugin which we don’t want to use. Prefer a code snippet we can add to a functions plugin we have.

    Darn issue is using for customer project submissions with images that might be 2400×1600 or something, so making some pretty big ‘smaller versions’ from forminable upload.

    Thank you for confirming the form system was not itself building the additional sizes based on uploads. 🙂

    Does not appear to be extra sizes in the base storefront theme functions; don’t want to hack woocommerce core, but still trying to find the source of the extra three thumbs.

    Will keep looking! 🙂

    Thread Starter neotrope

    (@neotrope)

    For anyone else looking for this topic, these resources have me on the right track

    https://wp-mix.com/wordpress-display-all-registered-image-sizes/

    and

    https://perishablepress.com/disable-wordpress-generated-images/

    Thread Starter neotrope

    (@neotrope)

    OKAY! As I am likely not the only one who has run into this issue, final solution for those
    a) using formidable to have images uploaded from client on form
    b) using woocommerce install, with storefront theme
    c) who want to ‘quash’ the three thumbs made by woocommerce entirely which are separate from the default wordpress defaults — meaning, by default for every upload, you get six more copies you don’t want or need

    So, this only applies to quashing the woocommerce versions which don’t seem able to be tackled via the normal unset methods or by using the hooks

    This should work but did not – note unique names of the woocommerce image thumbs
    function shapeSpace_disable_other_image_sizes() {

    remove_image_size(‘post-thumbnail’); // disable images added via set_post_thumbnail_size()
    remove_image_size(‘woocommerce_thumbnail’); // disable any other added image sizes
    remove_image_size(‘woocommerce_single’); // disable any other added image sizes
    remove_image_size(‘woocommerce_gallery_thumbnail’); // disable any other added image sizes

    }
    add_action(‘init’, ‘shapeSpace_disable_other_image_sizes’);

    However, finding another option from the WooCommerce codex on changing their default image sizes, I used the ‘zero out sizes’ trick, also used for default WP image thumbs:

    THIS WORKS: (could probably put in array, but hey…)

    add_filter( ‘woocommerce_get_image_size_gallery_thumbnail’, function( $size ) {
    return array(
    ‘width’ => 0,
    ‘height’ => 0,
    ‘crop’ => 0,
    );
    } );
    add_filter( ‘woocommerce_get_image_size_single’, function( $size ) {
    return array(
    ‘width’ => 0,
    ‘height’ => 0,
    ‘crop’ => 0,
    );
    } );
    add_filter( ‘woocommerce_get_image_size_thumbnail’, function( $size ) {
    return array(
    ‘width’ => 0,
    ‘height’ => 0,
    ‘crop’ => 0,
    );
    } );

    Plugin Support Jonathan Martínez

    (@jonathanenlared)

    Hey @neotrope

    Thank you for sharing this solution with the Formidable community.

    Best,

    Thread Starter neotrope

    (@neotrope)

    Feel free to move that to any knowledge base on your main site. I could have put in support ticket, but this was more general to interaction with Formidable, than a Formidable hook specifically 🙂

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.