From c606a0c9316cc92c1adb4d81001756af21b0fe5b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rapha=C3=ABl=20Droz?= <raphael.droz+floss@gmail.com>
Date: Fri, 4 Jan 2019 10:39:58 -0300
Subject: [PATCH] #44867 image editor: save modified image as a new copy,
handle possibly new image size
---
wp-admin/includes/image-edit.php | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/wp-admin/includes/image-edit.php b/wp-admin/includes/image-edit.php
index 773f3b9..c026876 100644
a
|
b
|
function wp_save_image( $post_id ) { |
840 | 840 | $sizes = array( 'thumbnail' ); |
841 | 841 | $success = $delete = $nocrop = true; |
842 | 842 | } elseif ( 'new' == $target ) { |
| 843 | $size = $img->get_size(); |
| 844 | $meta['width'] = $size['width']; // cropped and saved as a copy |
| 845 | $meta['height'] = $size['height']; |
| 846 | |
843 | 847 | $new_post = (array)$post; |
844 | 848 | unset( $new_post['ID'], $new_post['post_date'], $new_post['post_date_gmt'], $new_post['post_modified'], $new_post['post_modified_gmt'] ); |
845 | 849 | $new_post['post_title'] = preg_match('/\.[a-z]{3}$/', $new_post['post_title']) ? preg_replace('/(\.[a-z]{3})/', '-media-copy\1', $new_post['post_title']) : $new_post['post_title'] . '-mediacopy'; |