image_advanced don't resize images like wordpress do.

Support General image_advanced don't resize images like wordpress do.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #47411
    pixluserpixluser
    Participant

    Hello,

    I've so big images of more than 17mo on the website, because I discovered than upload image using image_advanced don't resize pictures like wordpress do.

    Is it possible to have it? To maintain the same usability?

    Is it possible to activate it somehow?

    Because now I'm struggling finding a way to resize all the pictures, at the same size @ 2560 px width… and it's a big job on big websites…

    Thanks a lot.

    #47412
    pixluserpixluser
    Participant

    Here is the wordpress link to the command: https://developer.wordpress.org/reference/functions/wp_create_image_subsizes/

    #47413
    pixluserpixluser
    Participant

    do this code can work for me?

    add_action('rwmb_after_save_field', function ($null, $field, $new, $old, $object_id) {
        // Only process 'image_advanced' fields
        if ($field['id'] === 'your_meta_field_id' && !empty($new)) {
            foreach ((array) $new as $image_id) {
                // Check if the image exists
                if (get_post_mime_type($image_id) === 'image/jpeg' || get_post_mime_type($image_id) === 'image/png' || get_post_mime_type($image_id) === 'image/webp') {
                    // Generate WordPress standard sizes (thumbnail, medium, large)
                    wp_create_image_subsizes(get_attached_file($image_id), $image_id);
                }
            }
        }
    }, 10, 4);
    #47415
    PeterPeter
    Moderator

    Hello,

    Can you please tell me more about this state "I discovered than upload image using image_advanced don't resize pictures like WordPress do"?

    The field image_advanced uses the WordPress media library popup and allows users to upload images on the site so WordPress also generates thumbnail images for the uploaded images as well. You can check the thumbnail images in the folder /wp-content/uploads/current-year/current-month folder.

    #47424
    pixluserpixluser
    Participant

    I have pictures of more than 7000px width, and more than 25mo. Using image_advanced, using a script that search for pictures automatically and add them to the gallery for me.

    Including picture links into the gallery by code for pictures that didn't came from the media library, can provoke that behaviour maybe?

    thanks, gotta check it with the dev of the script.

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