diff --git a/src/wp-admin/includes/ajax-actions.php b/src/wp-admin/includes/ajax-actions.php
index 773be72833..d1700d9fa0 100644
a
|
b
|
function wp_ajax_media_create_image_subsizes() { |
2441 | 2441 | } |
2442 | 2442 | } |
2443 | 2443 | |
| 2444 | // Set a custom header with the attachment_id. |
| 2445 | // Used by the browser/client to resume creating image sub-sizes after a PHP fatal error. |
| 2446 | if ( ! headers_sent() ) { |
| 2447 | header( 'X-WP-Upload-Attachment-ID: ' . $attachment_id ); |
| 2448 | } |
| 2449 | |
2444 | 2450 | // This can still be pretty slow and cause timeout or out of memory errors. |
2445 | 2451 | // The js that handles the response would need to also handle HTTP 500 errors. |
2446 | 2452 | wp_update_image_subsizes( $attachment_id ); |
diff --git a/src/wp-admin/includes/image.php b/src/wp-admin/includes/image.php
index 1582ceb3df..31577acc25 100644
a
|
b
|
function wp_create_image_subsizes( $file, $attachment_id ) { |
251 | 251 | return $image_meta; |
252 | 252 | } |
253 | 253 | |
254 | | // Set a custom header with the attachment_id. |
255 | | // Used by the browser/client to resume creating image sub-sizes after a PHP fatal error. |
256 | | if ( ! headers_sent() ) { |
257 | | header( 'X-WP-Upload-Attachment-ID: ' . $attachment_id ); |
258 | | } |
259 | | |
260 | 254 | // Resize the image |
261 | 255 | $resized = $editor->resize( $threshold, $threshold ); |
262 | 256 | $rotated = null; |
… |
… |
function wp_create_image_subsizes( $file, $attachment_id ) { |
297 | 291 | return $image_meta; |
298 | 292 | } |
299 | 293 | |
300 | | if ( ! headers_sent() ) { |
301 | | header( 'X-WP-Upload-Attachment-ID: ' . $attachment_id ); |
302 | | } |
303 | | |
304 | 294 | // Rotate the image |
305 | 295 | $rotated = $editor->maybe_exif_rotate(); |
306 | 296 | |
… |
… |
function _wp_make_subsizes( $new_sizes, $file, $image_meta, $attachment_id ) { |
400 | 390 | return $image_meta; |
401 | 391 | } |
402 | 392 | |
403 | | // Set a custom header with the attachment_id. |
404 | | // Used by the browser/client to resume creating image sub-sizes after a PHP fatal error. |
405 | | if ( ! headers_sent() ) { |
406 | | header( 'X-WP-Upload-Attachment-ID: ' . $attachment_id ); |
407 | | } |
408 | | |
409 | 393 | // If stored EXIF data exists, rotate the source image before creating sub-sizes. |
410 | 394 | if ( ! empty( $image_meta['image_meta'] ) ) { |
411 | 395 | $rotated = $editor->maybe_exif_rotate(); |
diff --git a/src/wp-admin/includes/media.php b/src/wp-admin/includes/media.php
index 18e87baa71..b9e9acc99d 100644
a
|
b
|
function media_handle_upload( $file_id, $post_id, $post_data = array(), $overrid |
408 | 408 | $attachment_id = wp_insert_attachment( $attachment, $file, $post_id, true ); |
409 | 409 | |
410 | 410 | if ( ! is_wp_error( $attachment_id ) ) { |
| 411 | // Set a custom header with the attachment_id. |
| 412 | // Used by the browser/client to resume creating image sub-sizes after a PHP fatal error. |
| 413 | if ( ! headers_sent() ) { |
| 414 | header( 'X-WP-Upload-Attachment-ID: ' . $attachment_id ); |
| 415 | } |
| 416 | |
411 | 417 | // The image sub-sizes are created during wp_generate_attachment_metadata(). |
412 | 418 | // This is generally slow and may cause timeouts or out of memory errors. |
413 | 419 | wp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, $file ) ); |