@@ 473-479 (lines=7) @@ | ||
470 | // for an image that was uploaded before the custom image was added to the theme. Try to determine the size manually. |
|
471 | $image_meta = wp_get_attachment_metadata( $attachment_id ); |
|
472 | ||
473 | if ( isset( $image_meta['width'], $image_meta['height'] ) ) { |
|
474 | $image_resized = image_resize_dimensions( $image_meta['width'], $image_meta['height'], $image_args['width'], $image_args['height'], $image_args['crop'] ); |
|
475 | if ( $image_resized ) { // This could be false when the requested image size is larger than the full-size image. |
|
476 | $image_meta['width'] = $image_resized[6]; |
|
477 | $image_meta['height'] = $image_resized[7]; |
|
478 | } |
|
479 | } |
|
480 | } |
|
481 | ||
482 | if ( isset( $image_meta['width'], $image_meta['height'] ) ) { |
|
@@ 482-488 (lines=7) @@ | ||
479 | } |
|
480 | } |
|
481 | ||
482 | if ( isset( $image_meta['width'], $image_meta['height'] ) ) { |
|
483 | $image_args['width'] = $image_meta['width']; |
|
484 | $image_args['height'] = $image_meta['height']; |
|
485 | ||
486 | list( $image_args['width'], $image_args['height'] ) = image_constrain_size_for_editor( $image_args['width'], $image_args['height'], $size, 'display' ); |
|
487 | $has_size_meta = true; |
|
488 | } |
|
489 | ||
490 | // Expose determined arguments to a filter before passing to Photon |
|
491 | $transform = $image_args['crop'] ? 'resize' : 'fit'; |