Make WordPress Core


Ignore:
Timestamp:
09/10/2009 10:07:33 PM (15 years ago)
Author:
azaozz
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin-ajax.php

    r11881 r11911  
    111111
    112112    die('0');
     113    break;
     114case 'load-preview-image' :
     115    $post_id = intval($_GET['postid']);
     116    if ( empty($post_id) || !current_user_can('edit_post', $post_id) )
     117        die('-1');
     118
     119    check_ajax_referer( "image_editor-$post_id" );
     120
     121    include_once( ABSPATH . 'wp-admin/includes/image-edit.php' );
     122    if ( !stream_preview_image($post_id) )
     123        die('-1');
     124
     125    die();
    113126    break;
    114127default :
     
    13361349    die();
    13371350    break;
     1351case 'image-edit-save':
     1352    // $post_id is the attachment ID
     1353    $post_id = intval($_POST['postid']);
     1354    if ( empty($post_id) || !current_user_can('edit_post', $post_id) )
     1355        die('-1');
     1356
     1357    check_ajax_referer( "image_editor-$post_id" );
     1358
     1359    include_once( ABSPATH . 'wp-admin/includes/image-edit.php' );
     1360    $msg = wp_save_image($post_id);
     1361
     1362    die($msg);
     1363    break;
     1364case 'open-image-editor' :
     1365    $post_id = intval($_POST['postid']);
     1366    if ( empty($post_id) || !current_user_can('edit_post', $post_id) )
     1367        die('-1');
     1368
     1369    check_ajax_referer( "image_editor-$post_id" );
     1370
     1371    include_once( ABSPATH . 'wp-admin/includes/image-edit.php' );
     1372    wp_image_editor($post_id);
     1373
     1374    die();
     1375    break;
    13381376default :
    13391377    do_action( 'wp_ajax_' . $_POST['action'] );
Note: See TracChangeset for help on using the changeset viewer.