]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/includes/image-edit.php
Wordpress 3.2-scripts
[autoinstalls/wordpress.git] / wp-admin / includes / image-edit.php
index e871ae5e5811a2e6dbffb562dce2bcec9a5b3ad8..86cdfe20a9204afc39cd21e12850a729c45caee5 100644 (file)
@@ -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'] );
-       } elseif ( WP_Http_Fopen::test() ) {
-               $filepath = wp_get_attachment_url($post_id);
+               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);
@@ -390,7 +391,7 @@ function image_edit_apply_changes($img, $changes) {
 
 function stream_preview_image($post_id) {
        $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, array(400, 400) );
 
        if ( !is_resource($img) )
@@ -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.');
@@ -492,10 +493,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 +551,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);