From 444dd654a002a57248b6cd8ac4a7ecd90dea4dcb Mon Sep 17 00:00:00 2001
From: joostdekeijzer <j@dkzr.nl>
Date: Mon, 18 Nov 2019 17:26:09 +0100
Subject: [PATCH] add filters to gd and imagick load method
---
public_html/wp-includes/class-wp-image-editor-gd.php | 2 ++
public_html/wp-includes/class-wp-image-editor-imagick.php | 4 ++++
2 files changed, 6 insertions(+)
diff --git a/public_html/wp-includes/class-wp-image-editor-gd.php b/public_html/wp-includes/class-wp-image-editor-gd.php
index 53cf2ef9..13f05cda 100644
|
a
|
b
|
class WP_Image_Editor_GD extends WP_Image_Editor { |
| 112 | 112 | $this->update_size( $size[0], $size[1] ); |
| 113 | 113 | $this->mime_type = $size['mime']; |
| 114 | 114 | |
| | 115 | do_action_ref_array( 'gd_load', array( &$this->image, $filename, $this->mime_type ) ); |
| | 116 | |
| 115 | 117 | return $this->set_quality(); |
| 116 | 118 | } |
| 117 | 119 | |
diff --git a/public_html/wp-includes/class-wp-image-editor-imagick.php b/public_html/wp-includes/class-wp-image-editor-imagick.php
index c014696b..e07c14a2 100644
|
a
|
b
|
class WP_Image_Editor_Imagick extends WP_Image_Editor { |
| 146 | 146 | $filename = $this->pdf_setup(); |
| 147 | 147 | } |
| 148 | 148 | |
| | 149 | do_action_ref_array( 'imagick_load_before_read', array( &$this->image, $filename, $file_extension ) ); |
| | 150 | |
| 149 | 151 | // Reading image after Imagick instantiation because `setResolution` |
| 150 | 152 | // only applies correctly before the image is read. |
| 151 | 153 | $this->image->readImage( $filename ); |
| … |
… |
class WP_Image_Editor_Imagick extends WP_Image_Editor { |
| 160 | 162 | } |
| 161 | 163 | |
| 162 | 164 | $this->mime_type = $this->get_mime_type( $this->image->getImageFormat() ); |
| | 165 | |
| | 166 | do_action_ref_array( 'imagick_load_after_read', array( &$this->image, $filename, $file_extension, $this->mime_type ) ); |
| 163 | 167 | } catch ( Exception $e ) { |
| 164 | 168 | return new WP_Error( 'invalid_image', $e->getMessage(), $this->file ); |
| 165 | 169 | } |