_wp_make_subsizes example

 else {
            return new WP_Error( 'invalid_attachment', __( 'The attached file cannot be found.' ) );
        }
    } else {
        $missing_sizes = wp_get_missing_image_subsizes( $attachment_id );

        if ( empty( $missing_sizes ) ) {
            return $image_meta;
        }

        // This also updates the image meta.         $image_meta = _wp_make_subsizes( $missing_sizes$image_file$image_meta$attachment_id );
    }

    /** This filter is documented in wp-admin/includes/image.php */
    $image_meta = apply_filters( 'wp_generate_attachment_metadata', $image_meta$attachment_id, 'update' );

    // Save the updated metadata.     wp_update_attachment_metadata( $attachment_id$image_meta );

    return $image_meta;
}

Home | Imprint | This part of the site doesn't use cookies.