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
133      public function load() {
134           if ( $this->image instanceof Imagick )
135                return true;
136
137           if ( ! is_file( $this->file ) && ! preg_match( '|^https?://|', $this->file ) )
138                return new WP_Error( 'error_loading_image', __('File doesn’t exist?'), $this->file );
139
140           /** This filter is documented in wp-includes/class-wp-image-editor-imagick.php */
141           // Even though Imagick uses less PHP memory than GD, set higher limit for users that have low PHP.ini limits
142           @ini_set( 'memory_limit', apply_filters( 'image_memory_limit', WP_MAX_MEMORY_LIMIT ) );
143
144           try {
145                $this->image = new Imagick( $this->file );
146
147                if ( ! $this->image->valid() )
148                     return new WP_Error( 'invalid_image', __('File is not an image.'), $this->file);
149
150                // Select the first frame to handle animated images properly
151                if ( is_callable( array( $this->image, 'setIteratorIndex' ) ) )