wp_ajax_imgedit_preview

The timeline below displays how wordpress function wp_ajax_imgedit_preview has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.3

/**
 * Handles image editor previews via AJAX.
 *
 * @since 3.1.0
 */
function wp_ajax_imgedit_preview()
{
    $post_id = (int) $_GET['postid'];
    if (empty($post_id) || !current_user_can('edit_post', $post_id)) {
        wp_die(-1);
    }
    check_ajax_referer("image_editor-{$post_id}");
    require_once ABSPATH . 'wp-admin/includes/image-edit.php';
    if (!stream_preview_image($post_id)) {
        wp_die(-1);
    }
    wp_die();
}

WordPress Version: 5.6

/**
 * Ajax handler for image editor previews.
 *
 * @since 3.1.0
 */
function wp_ajax_imgedit_preview()
{
    $post_id = (int) $_GET['postid'];
    if (empty($post_id) || !current_user_can('edit_post', $post_id)) {
        wp_die(-1);
    }
    check_ajax_referer("image_editor-{$post_id}");
    include_once ABSPATH . 'wp-admin/includes/image-edit.php';
    if (!stream_preview_image($post_id)) {
        wp_die(-1);
    }
    wp_die();
}

WordPress Version: 4.0

/**
 * Ajax handler for image editor previews.
 *
 * @since 3.1.0
 */
function wp_ajax_imgedit_preview()
{
    $post_id = intval($_GET['postid']);
    if (empty($post_id) || !current_user_can('edit_post', $post_id)) {
        wp_die(-1);
    }
    check_ajax_referer("image_editor-{$post_id}");
    include_once ABSPATH . 'wp-admin/includes/image-edit.php';
    if (!stream_preview_image($post_id)) {
        wp_die(-1);
    }
    wp_die();
}

WordPress Version: 3.7

function wp_ajax_imgedit_preview()
{
    $post_id = intval($_GET['postid']);
    if (empty($post_id) || !current_user_can('edit_post', $post_id)) {
        wp_die(-1);
    }
    check_ajax_referer("image_editor-{$post_id}");
    include_once ABSPATH . 'wp-admin/includes/image-edit.php';
    if (!stream_preview_image($post_id)) {
        wp_die(-1);
    }
    wp_die();
}