Image editing (first run). Includes code by stephanreiter, see #10528

git-svn-id: https://develop.svn.wordpress.org/trunk@11911 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz
2009-09-10 22:07:33 +00:00
parent 09845dfd03
commit 4f22e99cf5
28 changed files with 2335 additions and 42 deletions
+38
View File
@@ -111,6 +111,19 @@ case 'wp-compression-test' :
die('0');
break;
case 'load-preview-image' :
$post_id = intval($_GET['postid']);
if ( empty($post_id) || !current_user_can('edit_post', $post_id) )
die('-1');
check_ajax_referer( "image_editor-$post_id" );
include_once( ABSPATH . 'wp-admin/includes/image-edit.php' );
if ( !stream_preview_image($post_id) )
die('-1');
die();
break;
default :
do_action( 'wp_ajax_' . $_GET['action'] );
die('0');
@@ -1333,6 +1346,31 @@ case 'save-widget' :
if ( $form = $wp_registered_widget_controls[$widget_id] )
call_user_func_array( $form['callback'], $form['params'] );
die();
break;
case 'image-edit-save':
// $post_id is the attachment ID
$post_id = intval($_POST['postid']);
if ( empty($post_id) || !current_user_can('edit_post', $post_id) )
die('-1');
check_ajax_referer( "image_editor-$post_id" );
include_once( ABSPATH . 'wp-admin/includes/image-edit.php' );
$msg = wp_save_image($post_id);
die($msg);
break;
case 'open-image-editor' :
$post_id = intval($_POST['postid']);
if ( empty($post_id) || !current_user_can('edit_post', $post_id) )
die('-1');
check_ajax_referer( "image_editor-$post_id" );
include_once( ABSPATH . 'wp-admin/includes/image-edit.php' );
wp_image_editor($post_id);
die();
break;
default :