• Plugin problem. Code that adds a picture in an Ajax request is performed to initialize the theme and wp_generate_attachment_metadata not adequately take
    into account the new dimensions added via add_image_size.

    For myself, I correct it in this code directly in the plugin. But this is not the best option.

    
        if ($attach_id == 0) die('Error: File attachment error');
    
        // added image sizes from theme  
        add_image_size( 'thumb-small', 160, 160, true );
        add_image_size( 'thumb-standard', 320, 320, true );
        add_image_size( 'thumb-medium', 520, 245, true );
        add_image_size( 'thumb-large', 720, 340, true );
        // ----------------------------
    
        $attach_data = wp_generate_attachment_metadata($attach_id, $target_file_name);
    
  • The topic ‘Pixabay Images & add_image_size’ is closed to new replies.