Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #752720

    Hi,

    I’m almost finishing my fashion marketplace, using Enfold.
    I’m going to have absolute need to implement on my wocommerce products fashion images a ratio around 4:5, 4:6, not square as the enfold demos.

    Let’s see this example:
    Woocommerce Catalog Images settings: 450×675 (Hard Crop).
    If we upload non-square images with measures below the settings above, images are not displayed correctly in the store and homepage.
    I need to avoid this, because I’m going to have hundreds of vendors uploading images.

    So I have two questions :
    1 – How to prevent images for uploading below woocommerce settings?
    2 – How to automatically reduce an image to a maximum size?

    Kind Regards

    Elsa Soares

    #755232

    Hey Elsa,

    After changing image sizes, please regenerate them using this plugin – https://wordpress.org/plugins/regenerate-thumbnails/. You could also try to uncheck hard crop.

    I think it would be the best if you informed your vendors so they would upload images in your desired size to avoid the issue.

    Best regards,
    Yigit

    #756623

    Hi Yigit,

    Thank you for the reply.

    I know I need to regenerate thumbnails, whenever I make changes to image settings.
    Unchecking hard crop the remedy is worse than the disease!
    To inform vendors for the images size is an option, but it will be the last one, as it is not practical and there will always be faults, besides requiring a tight control.

    I thought you could give me a code for that.

    I’ve been doing some research and found the following:
    http://wordpress.stackexchange.com/questions/28359/how-to-require-a-minimum-image-dimension-for-uploading.
    http://wordpress.stackexchange.com/questions/130203/limit-image-resolution-on-upload.

    However, since I’m no expert on the subject, maybe you can help me. :)

    Kind Regards
    Elsa Soares

    #759599

    Hi,

    I’m sorry to say, but lately I have verified that your support is losing quality, essentially for two reasons:
    1 – You are taking many more days to answer. And it was not just once, there were several situations.
    2 – You end up limiting your help to practically the trivial and in the rest your answers turn out to be evasive.

    I sincerely hope this is a timely situation and that your support will return to the unique quality that you have accustomed me. Only then is it worth continuing to pay to have your support.

    Kind Regards
    Elsa Soares

    #759720

    Hi!

    We sorry you feel that way, we are already more members and we are speeding up as much as possible to catch up all the questions.
    You also do have to understand that, we have a limit to provide replies for Enfold related questions and not general WordPress questions.
    We do although try to cover as many possible replies.

    It seems that the filter here

    /* Marc Dingena Utilities
     * Test image resolution before image crunch
     */
    add_filter('wp_handle_upload_prefilter','mdu_validate_image_size');
    function mdu_validate_image_size( $file ) {
        $image = getimagesize($file['tmp_name']);
        $minimum = array(
            'width' => '400',
            'height' => '400'
        );
        $maximum = array(
            'width' => '2000',
            'height' => '2000'
        );
        $image_width = $image[0];
        $image_height = $image[1];
    
        $too_small = "Image dimensions are too small. Minimum size is {$minimum['width']} by {$minimum['height']} pixels. Uploaded image is $image_width by $image_height pixels.";
        $too_large = "Image dimensions are too large. Maximum size is {$maximum['width']} by {$maximum['height']} pixels. Uploaded image is $image_width by $image_height pixels.";
    
        if ( $image_width < $minimum['width'] || $image_height < $minimum['height'] ) {
            // add in the field 'error' of the $file array the message 
            $file['error'] = $too_small; 
            return $file;
        }
        elseif ( $image_width > $maximum['width'] || $image_height > $maximum['height'] ) {
            //add in the field 'error' of the $file array the message
            $file['error'] = $too_large; 
            return $file;
        }
        else
            return $file;
    }

    Seems to be the best possible way, but again you will have to use it your self, test what works and what not, so you can be able to find the best way for you.

    Thank you very much for your understanding

    Regards,
    Basilis

    #759773

    Hi Basilis,

    Thanks for your answer.

    Kind Regards
    Elsa Soares

    #759786

    Hi,
    Thank you for using Enfold.

    Best regards,
    Mike

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘Catalog wocommerce product images’ is closed to new replies.