Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: image_memory_limit

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
115      public function load() {
116           if ( $this->image instanceof Imagick )
117                return true;
118
119           if ( ! is_file( $this->file ) && ! preg_match( '|^https?://|', $this->file ) )
120                return new WP_Error( 'error_loading_image', __('File doesn’t exist?'), $this->file );
121
122           /** This filter is documented in wp-includes/class-wp-image-editor-imagick.php */
123           // Even though Imagick uses less PHP memory than GD, set higher limit for users that have low PHP.ini limits
124           @ini_set( 'memory_limit', apply_filters( 'image_memory_limit', WP_MAX_MEMORY_LIMIT ) );
125
126           try {
127                $this->image = new Imagick( $this->file );
128
129                if( ! $this->image->valid() )
130                     return new WP_Error( 'invalid_image', __('File is not an image.'), $this->file);
131
132                // Select the first frame to handle animated images properly
133                if ( is_callable( array( $this->image, 'setIteratorIndex' ) ) )