WordPress 3.4
[autoinstalls/wordpress.git] / wp-admin / includes / image-edit.php
index 0e2027a1eac7106a566b3559116f41ab651599b8..d2d6dc2cf30f411a6dd977fdf107fb6aa11b852a 100644 (file)
@@ -67,7 +67,7 @@ function wp_image_editor($post_id, $msg = false) {
        <input type="hidden" id="imgedit-y-<?php echo $post_id; ?>" value="<?php echo $meta['height']; ?>" />
 
        <div id="imgedit-crop-<?php echo $post_id; ?>" class="imgedit-crop-wrap">
-       <img id="image-preview-<?php echo $post_id; ?>" onload="imageEdit.imgLoaded('<?php echo $post_id; ?>')" src="<?php echo admin_url('admin-ajax.php'); ?>?action=imgedit-preview&amp;_ajax_nonce=<?php echo $nonce; ?>&amp;postid=<?php echo $post_id; ?>&amp;rand=<?php echo rand(1, 99999); ?>" />
+       <img id="image-preview-<?php echo $post_id; ?>" onload="imageEdit.imgLoaded('<?php echo $post_id; ?>')" src="<?php echo admin_url( 'admin-ajax.php', 'relative' ); ?>?action=imgedit-preview&amp;_ajax_nonce=<?php echo $nonce; ?>&amp;postid=<?php echo $post_id; ?>&amp;rand=<?php echo rand(1, 99999); ?>" />
        </div>
 
        <div class="imgedit-submit">
@@ -192,50 +192,11 @@ function wp_image_editor($post_id, $msg = false) {
        </tbody></table>
        <div class="imgedit-wait" id="imgedit-wait-<?php echo $post_id; ?>"></div>
        <script type="text/javascript">imageEdit.init(<?php echo $post_id; ?>);</script>
-       <div class="hidden" id="imgedit-leaving-<?php echo $post_id; ?>"><?php _e("There are unsaved changes that will be lost.  'OK' to continue, 'Cancel' to return to the Image Editor."); ?></div>
+       <div class="hidden" id="imgedit-leaving-<?php echo $post_id; ?>"><?php _e("There are unsaved changes that will be lost. 'OK' to continue, 'Cancel' to return to the Image Editor."); ?></div>
        </div>
 <?php
 }
 
-function load_image_to_edit($post_id, $mime_type, $size = 'full') {
-       $filepath = get_attached_file($post_id);
-
-       if ( $filepath && file_exists($filepath) ) {
-               if ( 'full' != $size && ( $data = image_get_intermediate_size($post_id, $size) ) ) {
-                       $filepath = apply_filters('load_image_to_edit_filesystempath', path_join( dirname($filepath), $data['file'] ), $post_id, $size);
-               }
-       } elseif ( function_exists('fopen') && function_exists('ini_get') && true == ini_get('allow_url_fopen') ) {
-               $filepath = apply_filters('load_image_to_edit_attachmenturl', wp_get_attachment_url($post_id) , $post_id, $size);
-       }
-
-       $filepath = apply_filters('load_image_to_edit_path', $filepath, $post_id, $size);
-       if ( empty($filepath) )
-               return false;
-
-       switch ( $mime_type ) {
-               case 'image/jpeg':
-                       $image = imagecreatefromjpeg($filepath);
-                       break;
-               case 'image/png':
-                       $image = imagecreatefrompng($filepath);
-                       break;
-               case 'image/gif':
-                       $image = imagecreatefromgif($filepath);
-                       break;
-               default:
-                       $image = false;
-                       break;
-       }
-       if ( is_resource($image) ) {
-               $image = apply_filters('load_image_to_edit', $image, $post_id, $size);
-               if ( function_exists('imagealphablending') && function_exists('imagesavealpha') ) {
-                       imagealphablending($image, false);
-                       imagesavealpha($image, true);
-               }
-       }
-       return $image;
-}
-
 function wp_stream_image($image, $mime_type, $post_id) {
        $image = apply_filters('image_save_pre', $image, $post_id);
 
@@ -288,7 +249,6 @@ function _rotate_image_resource($img, $angle) {
        return $img;
 }
 
-
 function _flip_image_resource($img, $horz, $vert) {
        $w = imagesx($img);
        $h = imagesy($img);
@@ -665,4 +625,3 @@ function wp_save_image($post_id) {
        $return->msg = esc_js( __('Image saved') );
        return $return;
 }
-