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
91           /**
92            * Filter the memory limit allocated for image manipulation.
93            *
94            * @since 3.5.0
95            *
96            * @param int|string $limit Maximum memory limit to allocate for images. Default WP_MAX_MEMORY_LIMIT.
97            *                          Accepts an integer (bytes), or a shorthand string notation, such as '256M'.
98            */
99           // Set artificially high because GD uses uncompressed images in memory
100           @ini_set( 'memory_limit', apply_filters( 'image_memory_limit', WP_MAX_MEMORY_LIMIT ) );
101
102           $this->image = @imagecreatefromstring( file_get_contents( $this->file ) );
103
104           if ( ! is_resource( $this->image ) )
105                return new WP_Error( 'invalid_image', __('File is not an image.'), $this->file );
106
107           $size = @getimagesize( $this->file );
108           if ( ! $size )
109                return new WP_Error( 'invalid_image', __('Could not read image size.'), $this->file );