| @@ -50,8 +50,9 @@ | ||
| 50 | 50 | add_filter( 'wpmcs_get_attached_file_noop', array( $this, 'image_editor_download_file' ), 10, 4 ); |
| 51 | 51 | add_filter( 'wpmcs_get_attached_file', array( $this, 'image_editor_download_file' ), 10, 4 ); |
| 52 | 52 | add_filter( 'wpmcs_get_attached_file', array( $this, 'customizer_crop_download_file' ), 10, 4 ); |
| 53 | 53 | add_filter( 'wpmcs_pre_update_item_additional_files_to_remove_from_server', [ $this, 'customizer_crop_remove_restored_files' ], 10, 5 ); |
| 54 | + add_filter( 'wpmcs_do_reupload_media', [ $this, 'force_reupload_on_image_editor_save' ], 10, 3 ); | |
| 54 | 55 | |
| 55 | 56 | /* |
| 56 | 57 | * WP_Customize_Control |
| 57 | 58 | * /wp-includes/class-wp-customize_control.php |
| @@ -200,8 +201,29 @@ | ||
| 200 | 201 | } |
| 201 | 202 | |
| 202 | 203 | return $url; |
| 203 | 204 | } |
| 205 | + | |
| 206 | + /** | |
| 207 | + * A flip or 180° rotation changes pixel content without changing any | |
| 208 | + * declared width/height, which shouldForceReupload() can't detect — | |
| 209 | + * force it explicitly for any image-editor commit (save or restore). | |
| 210 | + * @since 1.4.3 | |
| 211 | + */ | |
| 212 | + public function force_reupload_on_image_editor_save($do_reupload, $attachment_id, $source_type) { | |
| 213 | + if ($do_reupload) { | |
| 214 | + return $do_reupload; | |
| 215 | + } | |
| 216 | + | |
| 217 | + $action = Utils::filter_input('action', INPUT_GET) ?: Utils::filter_input('action', INPUT_POST); | |
| 218 | + $do = Utils::filter_input('do', INPUT_POST); | |
| 219 | + | |
| 220 | + if (in_array($do, ['save', 'restore'], true) && in_array($action, ['image-editor', 'imgedit-preview'], true)) { | |
| 221 | + return true; | |
| 222 | + } | |
| 223 | + | |
| 224 | + return $do_reupload; | |
| 225 | + } | |
| 204 | 226 | |
| 205 | 227 | |
| 206 | 228 | |
| 207 | 229 | |