wp_get_additional_image_sizes example

/** * Returns HTML for the post thumbnail meta box. * * @since 2.9.0 * * @param int|null $thumbnail_id Optional. Thumbnail attachment ID. Default null. * @param int|WP_Post|null $post Optional. The post ID or object associated * with the thumbnail. Defaults to global $post. * @return string The post thumbnail HTML. */
function _wp_post_thumbnail_html( $thumbnail_id = null, $post = null ) {
    $_wp_additional_image_sizes = wp_get_additional_image_sizes();

    $post               = get_post( $post );
    $post_type_object   = get_post_type_object( $post->post_type );
    $set_thumbnail_link = '<p class="hide-if-no-js"><a href="%s" id="set-post-thumbnail"%s class="thickbox">%s</a></p>';
    $upload_iframe_src  = get_upload_iframe_src( 'image', $post->ID );

    $content = sprintf(
        $set_thumbnail_link,
        esc_url( $upload_iframe_src ),
        '', // Empty when there's no featured image set, `aria-describedby` attribute otherwise.         esc_html( $post_type_object->labels->set_featured_image )
    );

function image_constrain_size_for_editor( $width$height$size = 'medium', $context = null ) {
    global $content_width;

    $_wp_additional_image_sizes = wp_get_additional_image_sizes();

    if ( ! $context ) {
        $context = is_admin() ? 'edit' : 'display';
    }

    if ( is_array( $size ) ) {
        $max_width  = $size[0];
        $max_height = $size[1];
    } elseif ( 'thumb' === $size || 'thumbnail' === $size ) {
        $max_width  = (int) get_option( 'thumbnail_size_w' );
        $max_height = (int) get_option( 'thumbnail_size_h' );
        
/** * Saves image to post, along with enqueued changes * in `$_REQUEST['history']`. * * @since 2.9.0 * * @param int $post_id Attachment post ID. * @return stdClass */
function wp_save_image( $post_id ) {
    $_wp_additional_image_sizes = wp_get_additional_image_sizes();

    $return  = new stdClass();
    $success = false;
    $delete  = false;
    $scaled  = false;
    $nocrop  = false;
    $post    = get_post( $post_id );

    $img = wp_get_image_editor( _load_image_to_edit_path( $post_id, 'full' ) );
    if ( is_wp_error( $img ) ) {
        $return->error = esc_js( __( 'Unable to create new image.' ) );
        
Home | Imprint | This part of the site doesn't use cookies.