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