W3cubDocs

/WordPress

wp_ajax_imgedit_preview()

Ajax handler for image editor previews.

Source

File: wp-admin/includes/ajax-actions.php

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();
}

Changelog

Version Description
3.1.0 Introduced.

© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_ajax_imgedit_preview