@@ -109,8 +109,8 @@ function wp_image_editor( $post_id, $msg = false ) {
109109 <input type="hidden" id="imgedit-history-<?php echo $ post_id ; ?> " value="" />
110110 <input type="hidden" id="imgedit-undone-<?php echo $ post_id ; ?> " value="0" />
111111 <input type="hidden" id="imgedit-selection-<?php echo $ post_id ; ?> " value="" />
112- <input type="hidden" id="imgedit-x-<?php echo $ post_id ; ?> " value="<?php echo isset ( $ meta ['width ' ] ) ? $ meta [ ' width ' ] : 0 ; ?> " />
113- <input type="hidden" id="imgedit-y-<?php echo $ post_id ; ?> " value="<?php echo isset ( $ meta ['height ' ] ) ? $ meta [ ' height ' ] : 0 ; ?> " />
112+ <input type="hidden" id="imgedit-x-<?php echo $ post_id ; ?> " value="<?php echo $ meta ['width ' ] ?? 0 ; ?> " />
113+ <input type="hidden" id="imgedit-y-<?php echo $ post_id ; ?> " value="<?php echo $ meta ['height ' ] ?? 0 ; ?> " />
114114
115115 <div id="imgedit-crop-<?php echo $ post_id ; ?> " class="imgedit-crop-wrap">
116116 <div class="imgedit-crop-grid"></div>
@@ -154,10 +154,10 @@ function wp_image_editor( $post_id, $msg = false ) {
154154 _e ( 'scale height ' );
155155 ?>
156156 </label>
157- <input type="number" step="1" min="0" max="<?php echo isset ( $ meta ['width ' ] ) ? $ meta [ ' width ' ] : '' ; ?> " aria-describedby="imgedit-scale-warn-<?php echo $ post_id ; ?> " id="imgedit-scale-width-<?php echo $ post_id ; ?> " onkeyup="imageEdit.scaleChanged(<?php echo $ post_id ; ?> , 1, this)" onblur="imageEdit.scaleChanged(<?php echo $ post_id ; ?> , 1, this)" value="<?php echo isset ( $ meta ['width ' ] ) ? $ meta [ ' width ' ] : 0 ; ?> " />
157+ <input type="number" step="1" min="0" max="<?php echo $ meta ['width ' ] ?? '' ; ?> " aria-describedby="imgedit-scale-warn-<?php echo $ post_id ; ?> " id="imgedit-scale-width-<?php echo $ post_id ; ?> " onkeyup="imageEdit.scaleChanged(<?php echo $ post_id ; ?> , 1, this)" onblur="imageEdit.scaleChanged(<?php echo $ post_id ; ?> , 1, this)" value="<?php echo $ meta ['width ' ] ?? 0 ; ?> " />
158158 <span class="imgedit-separator" aria-hidden="true">×</span>
159159 <label for="imgedit-scale-height-<?php echo $ post_id ; ?> " class="screen-reader-text"><?php _e ( 'scale height ' ); ?> </label>
160- <input type="number" step="1" min="0" max="<?php echo isset ( $ meta ['height ' ] ) ? $ meta [ ' height ' ] : '' ; ?> " aria-describedby="imgedit-scale-warn-<?php echo $ post_id ; ?> " id="imgedit-scale-height-<?php echo $ post_id ; ?> " onkeyup="imageEdit.scaleChanged(<?php echo $ post_id ; ?> , 0, this)" onblur="imageEdit.scaleChanged(<?php echo $ post_id ; ?> , 0, this)" value="<?php echo isset ( $ meta ['height ' ] ) ? $ meta [ ' height ' ] : 0 ; ?> " />
160+ <input type="number" step="1" min="0" max="<?php echo $ meta ['height ' ] ?? '' ; ?> " aria-describedby="imgedit-scale-warn-<?php echo $ post_id ; ?> " id="imgedit-scale-height-<?php echo $ post_id ; ?> " onkeyup="imageEdit.scaleChanged(<?php echo $ post_id ; ?> , 0, this)" onblur="imageEdit.scaleChanged(<?php echo $ post_id ; ?> , 0, this)" value="<?php echo $ meta ['height ' ] ?? 0 ; ?> " />
161161 <button id="imgedit-scale-button" type="button" onclick="imageEdit.action(<?php echo "$ post_id, ' $ nonce' " ; ?> , 'scale')" class="button button-primary"><?php esc_html_e ( 'Scale ' ); ?> </button>
162162 </div>
163163 <span class="imgedit-scale-warn" id="imgedit-scale-warn-<?php echo $ post_id ; ?> "><span class="dashicons dashicons-warning" aria-hidden="true"></span><?php esc_html_e ( 'Images cannot be scaled to a size larger than the original. ' ); ?> </span>
@@ -744,10 +744,10 @@ function image_edit_apply_changes( $image, $changes ) {
744744 $ w = $ size ['width ' ];
745745 $ h = $ size ['height ' ];
746746
747- $ scale = isset ( $ sel ->r ) ? $ sel -> r : 1 / _image_get_preview_ratio ( $ w , $ h ); // Discard preview scaling.
747+ $ scale = $ sel ->r ?? 1 / _image_get_preview_ratio ( $ w , $ h ); // Discard preview scaling.
748748 $ image ->crop ( (int ) ( $ sel ->x * $ scale ), (int ) ( $ sel ->y * $ scale ), (int ) ( $ sel ->w * $ scale ), (int ) ( $ sel ->h * $ scale ) );
749749 } else {
750- $ scale = isset ( $ sel ->r ) ? $ sel -> r : 1 / _image_get_preview_ratio ( imagesx ( $ image ), imagesy ( $ image ) ); // Discard preview scaling.
750+ $ scale = $ sel ->r ?? 1 / _image_get_preview_ratio ( imagesx ( $ image ), imagesy ( $ image ) ); // Discard preview scaling.
751751 $ image = _crop_image_resource ( $ image , $ sel ->x * $ scale , $ sel ->y * $ scale , $ sel ->w * $ scale , $ sel ->h * $ scale );
752752 }
753753 break ;
0 commit comments