]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/includes/image-edit.php
Wordpress 3.1.1
[autoinstalls/wordpress.git] / wp-admin / includes / image-edit.php
index 457624ce3e9b1e3bd50f2b04dee6230bcf11082c..03e7144af04a6d933cd839923694425dbeca6741 100644 (file)
@@ -39,7 +39,7 @@ function wp_image_editor($post_id, $msg = false) {
        <div class="imgedit-menu">
                <div onclick="imageEdit.crop(<?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-crop disabled" title="<?php esc_attr_e( 'Crop' ); ?>"></div><?php
 
-       // On some setups GD library does not provide imagerotate() - Ticket #11536   
+       // On some setups GD library does not provide imagerotate() - Ticket #11536
        if ( function_exists('imagerotate') ) { ?>
                <div class="imgedit-rleft"  onclick="imageEdit.rotate( 90, <?php echo "$post_id, '$nonce'"; ?>, this)" title="<?php esc_attr_e( 'Rotate counter-clockwise' ); ?>"></div>
                <div class="imgedit-rright" onclick="imageEdit.rotate(-90, <?php echo "$post_id, '$nonce'"; ?>, this)" title="<?php esc_attr_e( 'Rotate clockwise' ); ?>"></div>
@@ -96,10 +96,10 @@ function wp_image_editor($post_id, $msg = false) {
        <div class="imgedit-group-top">
                <a class="imgedit-help-toggle" onclick="imageEdit.toggleHelp(this);return false;" href="#"><strong><?php _e('Restore Original Image'); ?></strong></a>
                <div class="imgedit-help">
-               <p><?php _e('Discard any changes and restore the original image.'); 
+               <p><?php _e('Discard any changes and restore the original image.');
 
                if ( !defined('IMAGE_EDIT_OVERWRITE') || !IMAGE_EDIT_OVERWRITE )
-                       _e(' Previously edited copies of the image will not be deleted.');
+                       echo ' '.__('Previously edited copies of the image will not be deleted.');
 
                ?></p>
                <div class="imgedit-submit">
@@ -118,7 +118,7 @@ function wp_image_editor($post_id, $msg = false) {
                <a class="imgedit-help-toggle" onclick="imageEdit.toggleHelp(this);return false;" href="#"><?php _e('(help)'); ?></a>
                <div class="imgedit-help">
                <p><?php _e('The image can be cropped by clicking on it and dragging to select the desired part. While dragging the dimensions of the selection are displayed below.'); ?></p>
-               <strong><?php _e('Keyboard shortcuts'); ?></strong>
+               <strong><?php _e('Keyboard Shortcuts'); ?></strong>
                <ul>
                <li><?php _e('Arrow: move by 10px'); ?></li>
                <li><?php _e('Shift + arrow: move by 1px'); ?></li>
@@ -201,10 +201,11 @@ 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 = path_join( dirname($filepath), $data['file'] );
+               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 ( WP_Http_Fopen::test() ) {
-               $filepath = wp_get_attachment_url($post_id);
+               $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);
@@ -421,7 +422,7 @@ function wp_restore_image($post_id) {
        $file = get_attached_file($post_id);
        $backup_sizes = get_post_meta( $post_id, '_wp_attachment_backup_sizes', true );
        $restored = false;
-       $msg = '';
+       $msg = new stdClass;
 
        if ( !is_array($backup_sizes) ) {
                $msg->error = __('Cannot load image metadata.');
@@ -453,7 +454,7 @@ function wp_restore_image($post_id) {
                $meta['file'] = _wp_relative_upload_path( $restored_file );
                $meta['width'] = $data['width'];
                $meta['height'] = $data['height'];
-               list ( $uwidth, $uheight ) = wp_shrink_dimensions($meta['width'], $meta['height']);
+               list ( $uwidth, $uheight ) = wp_constrain_dimensions($meta['width'], $meta['height'], 128, 96);
                $meta['hwstring_small'] = "height='$uheight' width='$uwidth'";
        }
 
@@ -492,7 +493,7 @@ function wp_restore_image($post_id) {
 }
 
 function wp_save_image($post_id) {
-       $return = '';
+       $return = new stdClass;
        $success = $delete = $scaled = $nocrop = false;
        $post = get_post($post_id);
        @ini_set('memory_limit', '256M');
@@ -598,7 +599,7 @@ function wp_save_image($post_id) {
                $meta['width'] = imagesx($img);
                $meta['height'] = imagesy($img);
 
-               list ( $uwidth, $uheight ) = wp_shrink_dimensions($meta['width'], $meta['height']);
+               list ( $uwidth, $uheight ) = wp_constrain_dimensions($meta['width'], $meta['height'], 128, 96);
                $meta['hwstring_small'] = "height='$uheight' width='$uwidth'";
 
                if ( $success && ('nothumb' == $target || 'all' == $target) ) {