Skip to content

Commit bb2d5a3

Browse files
DrewAPictureDrewAPicture
authored andcommitted
Docs: Ensure hook and duplicate hook docs directly precede all instances of the image_memory_limit filter.
Hook docs must directly precede hooks in order for the Code Reference parser to correctly identify them as such. Fixes #36968. git-svn-id: https://develop.svn.wordpress.org/trunk@37592 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 179a5f8 commit bb2d5a3

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

src/wp-includes/class-wp-image-editor-gd.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,10 @@ public function load() {
104104
* @param int|string $limit Maximum memory limit to allocate for images. Default WP_MAX_MEMORY_LIMIT.
105105
* Accepts an integer (bytes), or a shorthand string notation, such as '256M'.
106106
*/
107-
// Set artificially high because GD uses uncompressed images in memory
108-
@ini_set( 'memory_limit', apply_filters( 'image_memory_limit', WP_MAX_MEMORY_LIMIT ) );
107+
$image_memory_limit = apply_filters( 'image_memory_limit', WP_MAX_MEMORY_LIMIT );
108+
109+
// Set artificially high because GD uses uncompressed images in memory.
110+
@ini_set( 'memory_limit', $image_memory_limit );
109111

110112
$this->image = @imagecreatefromstring( file_get_contents( $this->file ) );
111113

src/wp-includes/class-wp-image-editor-imagick.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,13 @@ public function load() {
138138
return new WP_Error( 'error_loading_image', __('File doesn’t exist?'), $this->file );
139139

140140
/** This filter is documented in wp-includes/class-wp-image-editor-gd.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 ) );
141+
$image_memory_limit = apply_filters( 'image_memory_limit', WP_MAX_MEMORY_LIMIT );
142+
143+
/*
144+
* Even though Imagick uses less PHP memory than GD, set higher limit
145+
* for users that have low PHP.ini limits.
146+
*/
147+
@ini_set( 'memory_limit', $image_memory_limit );
143148

144149
try {
145150
$this->image = new Imagick( $this->file );

src/wp-includes/deprecated.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3175,8 +3175,12 @@ function wp_load_image( $file ) {
31753175
if ( ! function_exists('imagecreatefromstring') )
31763176
return __('The GD image library is not installed.');
31773177

3178-
// Set artificially high because GD uses uncompressed images in memory
3179-
@ini_set( 'memory_limit', apply_filters( 'image_memory_limit', WP_MAX_MEMORY_LIMIT ) );
3178+
/** This filter is documented in wp-includes/class-wp-image-editor-gd.php */
3179+
$image_memory_limit = apply_filters( 'image_memory_limit', WP_MAX_MEMORY_LIMIT );
3180+
3181+
// Set artificially high because GD uses uncompressed images in memory.
3182+
@ini_set( 'memory_limit', $image_memory_limit );
3183+
31803184
$image = imagecreatefromstring( file_get_contents( $file ) );
31813185

31823186
if ( !is_resource( $image ) )

0 commit comments

Comments
 (0)