Commit 9845632
committed
Attachments REST API: Apply unapplied EXIF orientation before image edits
Fixes image edits (rotate, crop, flip) landing in the wrong frame for photos whose EXIF orientation tag was never applied to their pixels, most visibly iPhone JPEGs. Rotating such a photo in the media editor modal or the Image block cropper previously appeared to do nothing.
`WP_REST_Attachments_Controller::edit_media_item()` edits the image from `wp_get_original_image_path()`. That original image often still carries an unapplied EXIF orientation tag.
`WP_REST_Attachments_Controller::edit_media_item()` now calls `$image_editor->maybe_exif_rotate()` before modifying the image for cropping.
Developed in: [https://github.com/WordPress/wordpress-develop/pull/12492](https://github.com/WordPress/wordpress-develop/pull/12492)
Props ramonopoly, andrewserong, adamsilverstein.
Fixes #65618.
git-svn-id: https://develop.svn.wordpress.org/trunk@62820 602fd350-edb4-49c9-b593-d223f7449a821 parent 921d09c commit 9845632
2 files changed
Lines changed: 87 additions & 0 deletions
File tree
- src/wp-includes/rest-api/endpoints
- tests/phpunit/tests/rest-api
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
959 | 959 | | |
960 | 960 | | |
961 | 961 | | |
| 962 | + | |
962 | 963 | | |
963 | 964 | | |
964 | 965 | | |
| |||
1064 | 1065 | | |
1065 | 1066 | | |
1066 | 1067 | | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
1067 | 1071 | | |
1068 | 1072 | | |
1069 | 1073 | | |
| |||
Lines changed: 83 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3149 | 3149 | | |
3150 | 3150 | | |
3151 | 3151 | | |
| 3152 | + | |
| 3153 | + | |
| 3154 | + | |
| 3155 | + | |
| 3156 | + | |
| 3157 | + | |
| 3158 | + | |
| 3159 | + | |
| 3160 | + | |
| 3161 | + | |
| 3162 | + | |
| 3163 | + | |
| 3164 | + | |
| 3165 | + | |
| 3166 | + | |
| 3167 | + | |
| 3168 | + | |
| 3169 | + | |
| 3170 | + | |
| 3171 | + | |
| 3172 | + | |
| 3173 | + | |
| 3174 | + | |
| 3175 | + | |
| 3176 | + | |
| 3177 | + | |
| 3178 | + | |
| 3179 | + | |
| 3180 | + | |
| 3181 | + | |
| 3182 | + | |
| 3183 | + | |
| 3184 | + | |
| 3185 | + | |
| 3186 | + | |
| 3187 | + | |
| 3188 | + | |
| 3189 | + | |
| 3190 | + | |
| 3191 | + | |
| 3192 | + | |
| 3193 | + | |
| 3194 | + | |
| 3195 | + | |
| 3196 | + | |
| 3197 | + | |
| 3198 | + | |
| 3199 | + | |
| 3200 | + | |
| 3201 | + | |
| 3202 | + | |
| 3203 | + | |
| 3204 | + | |
| 3205 | + | |
| 3206 | + | |
| 3207 | + | |
| 3208 | + | |
| 3209 | + | |
| 3210 | + | |
| 3211 | + | |
| 3212 | + | |
| 3213 | + | |
| 3214 | + | |
| 3215 | + | |
| 3216 | + | |
| 3217 | + | |
| 3218 | + | |
| 3219 | + | |
| 3220 | + | |
| 3221 | + | |
| 3222 | + | |
| 3223 | + | |
| 3224 | + | |
| 3225 | + | |
| 3226 | + | |
| 3227 | + | |
| 3228 | + | |
| 3229 | + | |
| 3230 | + | |
| 3231 | + | |
| 3232 | + | |
| 3233 | + | |
| 3234 | + | |
3152 | 3235 | | |
3153 | 3236 | | |
3154 | 3237 | | |
| |||
0 commit comments