Make WordPress Core

Ticket #13847: 13847.4.patch

File 13847.4.patch, 3.6 KB (added by hakre, 14 years ago)

Missing filter for media.php - image_memory_limit

  • wp-includes/default-constants.php

    ### Eclipse Workspace Patch 1.0
    #P wordpress-trunk bare
     
    2424                }
    2525        }
    2626
     27        if ( !defined('WP_MAX_MEMORY_LIMIT') ) {
     28                define('WP_MAX_MEMORY_LIMIT', '256M');
     29        }
     30
    2731        /**
    2832         * The $blog_id global, which you can change in the config allows you to create a simple
    2933         * multiple blog installation using just one WordPress and changing $blog_id around.
  • wp-admin/admin.php

     
    106106        require(ABSPATH . 'wp-admin/menu.php');
    107107
    108108if ( current_user_can( 'manage_options' ) )
    109         @ini_set( 'memory_limit', apply_filters( 'admin_memory_limit', '256M' ) );
     109        @ini_set( 'memory_limit', apply_filters( 'admin_memory_limit', WP_MAX_MEMORY_LIMIT ) );
    110110
    111111do_action('admin_init');
    112112
  • wp-admin/includes/file.php

     
    563563                return new WP_Error('fs_unavailable', __('Could not access filesystem.'));
    564564
    565565        // Unzip can use a lot of memory, but not this much hopefully
    566         @ini_set('memory_limit', '256M');
     566        @ini_set( 'memory_limit', apply_filters( 'admin_memory_limit', WP_MAX_MEMORY_LIMIT ) );
    567567
    568568        $needed_dirs = array();
    569569        $to = trailingslashit($to);
  • wp-includes/media.php

     
    250250                return __('The GD image library is not installed.');
    251251
    252252        // Set artificially high because GD uses uncompressed images in memory
    253         @ini_set('memory_limit', '256M');
     253        @ini_set( 'memory_limit', apply_filters( 'image_memory_limit', WP_MAX_MEMORY_LIMIT ) );
    254254        $image = imagecreatefromstring( file_get_contents( $file ) );
    255255
    256256        if ( !is_resource( $image ) )
  • wp-settings.php

     
    2020require( ABSPATH . WPINC . '/default-constants.php' );
    2121require( ABSPATH . WPINC . '/version.php' );
    2222
    23 // Set initial default constants including WP_MEMORY_LIMIT, WP_DEBUG, WP_CONTENT_DIR and WP_CACHE.
     23// Set initial default constants including WP_MEMORY_LIMIT, WP_MAX_MEMORY_LIMIT, WP_DEBUG, WP_CONTENT_DIR and WP_CACHE.
    2424wp_initial_constants( );
    2525
    2626// Disable magic quotes at runtime. Magic quotes are added using wpdb later in wp-settings.php.
  • wp-admin/includes/image-edit.php

     
    391391
    392392function stream_preview_image($post_id) {
    393393        $post = get_post($post_id);
    394         @ini_set('memory_limit', '256M');
     394        @ini_set( 'memory_limit', apply_filters( 'admin_memory_limit', WP_MAX_MEMORY_LIMIT ) );
    395395        $img = load_image_to_edit( $post_id, $post->post_mime_type, array(400, 400) );
    396396
    397397        if ( !is_resource($img) )
     
    496496        $return = new stdClass;
    497497        $success = $delete = $scaled = $nocrop = false;
    498498        $post = get_post($post_id);
    499         @ini_set('memory_limit', '256M');
     499        @ini_set( 'memory_limit', apply_filters( 'admin_memory_limit', WP_MAX_MEMORY_LIMIT ) );
    500500        $img = load_image_to_edit($post_id, $post->post_mime_type);
    501501
    502502        if ( !is_resource($img) ) {