X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/16b9f61a8ab25bd6c9fbfd0cea00c7bda22f6a71..8f374b7233bc2815ccc387e448d208c5434eb961:/wp-admin/includes/image-edit.php diff --git a/wp-admin/includes/image-edit.php b/wp-admin/includes/image-edit.php index 457624ce..d2d6dc2c 100644 --- a/wp-admin/includes/image-edit.php +++ b/wp-admin/includes/image-edit.php @@ -39,7 +39,7 @@ function wp_image_editor($post_id, $msg = false) {
, this)" class="imgedit-crop disabled" title="">
, this)" title="">
, this)" title="">
@@ -67,7 +67,7 @@ function wp_image_editor($post_id, $msg = false) {
- +
@@ -96,10 +96,10 @@ function wp_image_editor($post_id, $msg = false) {
-

@@ -118,7 +118,7 @@ function wp_image_editor($post_id, $msg = false) {

- +
  • @@ -192,49 +192,11 @@ function wp_image_editor($post_id, $msg = false) {
    - +
post_mime_type, array(400, 400) ); if ( !is_resource($img) ) @@ -421,7 +382,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.'); @@ -430,7 +391,7 @@ function wp_restore_image($post_id) { $parts = pathinfo($file); $suffix = time() . rand(100, 999); - $default_sizes = apply_filters( 'intermediate_image_sizes', array('large', 'medium', 'thumbnail') ); + $default_sizes = get_intermediate_image_sizes(); if ( isset($backup_sizes['full-orig']) && is_array($backup_sizes['full-orig']) ) { $data = $backup_sizes['full-orig']; @@ -453,7 +414,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,10 +453,10 @@ 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'); + @ini_set( 'memory_limit', apply_filters( 'admin_memory_limit', WP_MAX_MEMORY_LIMIT ) ); $img = load_image_to_edit($post_id, $post->post_mime_type); if ( !is_resource($img) ) { @@ -550,7 +511,7 @@ function wp_save_image($post_id) { // generate new filename $path = get_attached_file($post_id); - $path_parts = pathinfo52( $path ); + $path_parts = pathinfo( $path ); $filename = $path_parts['filename']; $suffix = time() . rand(100, 999); @@ -598,11 +559,11 @@ 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) ) { - $sizes = apply_filters( 'intermediate_image_sizes', array('large', 'medium', 'thumbnail') ); + $sizes = get_intermediate_image_sizes(); if ( 'nothumb' == $target ) $sizes = array_diff( $sizes, array('thumbnail') ); } @@ -664,4 +625,3 @@ function wp_save_image($post_id) { $return->msg = esc_js( __('Image saved') ); return $return; } -