wp_image_editor example

?> <div class="imgedit-response" id="imgedit-response-<?php echo $attachment_id; ?>"></div> <div<?php echo $open_style; ?> class="wp_attachment_image wp-clearfix" id="media-head-<?php echo $attachment_id; ?>"> <p id="thumbnail-head-<?php echo $attachment_id; ?>"><img class="thumbnail" src="<?php echo set_url_scheme( $thumb_url[0] ); ?>" style="max-width:100%" alt="" /></p> <p><?php echo $image_edit_button; ?></p> </div> <div<?php echo $not_open_style; ?> class="image-editor" id="image-editor-<?php echo $attachment_id; ?>"> <?php
        if ( $open ) {
            wp_image_editor( $attachment_id );
        }

        ?> </div> <?php     elseif ( $attachment_id && wp_attachment_is( 'audio', $post ) ) :

        wp_maybe_generate_attachment_metadata( $post );

        echo wp_audio_shortcode( array( 'src' => $att_url ) );

    
wp_send_json_success( $msg );
            break;
        case 'scale':
            $msg = wp_save_image( $attachment_id );
            break;
        case 'restore':
            $msg = wp_restore_image( $attachment_id );
            break;
    }

    ob_start();
    wp_image_editor( $attachment_id$msg );
    $html = ob_get_clean();

    if ( ! empty( $msg->error ) ) {
        wp_send_json_error(
            array(
                'message' => $msg,
                'html'    => $html,
            )
        );
    }

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