41 $note = "<div class='notice notice-error' tabindex='-1' role='alert'><p>$msg->error</p></div>"; |
41 $note = "<div class='notice notice-error' tabindex='-1' role='alert'><p>$msg->error</p></div>"; |
42 } elseif ( isset( $msg->msg ) ) { |
42 } elseif ( isset( $msg->msg ) ) { |
43 $note = "<div class='notice notice-success' tabindex='-1' role='alert'><p>$msg->msg</p></div>"; |
43 $note = "<div class='notice notice-success' tabindex='-1' role='alert'><p>$msg->msg</p></div>"; |
44 } |
44 } |
45 } |
45 } |
46 |
46 $edit_custom_sizes = false; |
|
47 /** |
|
48 * Filters whether custom sizes are available options for image editing. |
|
49 * |
|
50 * @since 6.0.0 |
|
51 * |
|
52 * @param bool|string[] $edit_custom_sizes True if custom sizes can be edited or array of custom size names. |
|
53 */ |
|
54 $edit_custom_sizes = apply_filters( 'edit_custom_thumbnail_sizes', $edit_custom_sizes ); |
47 ?> |
55 ?> |
48 <div class="imgedit-wrap wp-clearfix"> |
56 <div class="imgedit-wrap wp-clearfix"> |
49 <div id="imgedit-panel-<?php echo $post_id; ?>"> |
57 <div id="imgedit-panel-<?php echo $post_id; ?>"> |
50 |
58 |
51 <div class="imgedit-panel-content wp-clearfix"> |
59 <div class="imgedit-panel-content wp-clearfix"> |
237 |
245 |
238 <span class="imgedit-label"> |
246 <span class="imgedit-label"> |
239 <input type="radio" id="imgedit-target-nothumb" name="imgedit-target-<?php echo $post_id; ?>" value="nothumb" /> |
247 <input type="radio" id="imgedit-target-nothumb" name="imgedit-target-<?php echo $post_id; ?>" value="nothumb" /> |
240 <label for="imgedit-target-nothumb"><?php _e( 'All sizes except thumbnail' ); ?></label> |
248 <label for="imgedit-target-nothumb"><?php _e( 'All sizes except thumbnail' ); ?></label> |
241 </span> |
249 </span> |
|
250 <?php |
|
251 if ( $edit_custom_sizes ) { |
|
252 if ( ! is_array( $edit_custom_sizes ) ) { |
|
253 $edit_custom_sizes = get_intermediate_image_sizes(); |
|
254 } |
|
255 foreach ( array_unique( $edit_custom_sizes ) as $key => $size ) { |
|
256 if ( array_key_exists( $size, $meta['sizes'] ) ) { |
|
257 if ( 'thumbnail' === $size ) { |
|
258 continue; |
|
259 } |
|
260 ?> |
|
261 <span class="imgedit-label"> |
|
262 <input type="radio" id="imgedit-target-custom<?php echo esc_attr( $key ); ?>" name="imgedit-target-<?php echo $post_id; ?>" value="<?php echo esc_attr( $size ); ?>" /> |
|
263 <label for="imgedit-target-custom<?php echo esc_attr( $key ); ?>"><?php echo esc_html( $size ); ?></label> |
|
264 </span> |
|
265 <?php |
|
266 } |
|
267 } |
|
268 } |
|
269 ?> |
242 </fieldset> |
270 </fieldset> |
243 </div> |
271 </div> |
244 </div> |
272 </div> |
245 |
273 |
246 <?php } ?> |
274 <?php } ?> |
371 * returning that value instead. |
399 * returning that value instead. |
372 * |
400 * |
373 * @since 2.9.0 |
401 * @since 2.9.0 |
374 * @deprecated 3.5.0 Use {@see 'wp_save_image_editor_file'} instead. |
402 * @deprecated 3.5.0 Use {@see 'wp_save_image_editor_file'} instead. |
375 * |
403 * |
376 * @param mixed $override Value to return instead of saving. Default null. |
404 * @param bool|null $override Value to return instead of saving. Default null. |
377 * @param string $filename Name of the file to be saved. |
405 * @param string $filename Name of the file to be saved. |
378 * @param WP_Image_Editor $image The image editor instance. |
406 * @param resource|GdImage $image Image resource or GdImage instance. |
379 * @param string $mime_type The mime type of the image. |
407 * @param string $mime_type The mime type of the image. |
380 * @param int $post_id Attachment post ID. |
408 * @param int $post_id Attachment post ID. |
381 */ |
409 */ |
382 $saved = apply_filters_deprecated( |
410 $saved = apply_filters_deprecated( |
383 'wp_save_image_file', |
411 'wp_save_image_file', |
384 array( null, $filename, $image, $mime_type, $post_id ), |
412 array( null, $filename, $image, $mime_type, $post_id ), |
385 '3.5.0', |
413 '3.5.0', |
903 |
931 |
904 $size = $img->get_size(); |
932 $size = $img->get_size(); |
905 $meta['width'] = $size['width']; |
933 $meta['width'] = $size['width']; |
906 $meta['height'] = $size['height']; |
934 $meta['height'] = $size['height']; |
907 |
935 |
908 if ( $success && ( 'nothumb' === $target || 'all' === $target ) ) { |
936 if ( $success ) { |
909 $sizes = get_intermediate_image_sizes(); |
937 $sizes = get_intermediate_image_sizes(); |
910 if ( 'nothumb' === $target ) { |
938 if ( 'nothumb' === $target || 'all' === $target ) { |
911 $sizes = array_diff( $sizes, array( 'thumbnail' ) ); |
939 if ( 'nothumb' === $target ) { |
|
940 $sizes = array_diff( $sizes, array( 'thumbnail' ) ); |
|
941 } |
|
942 } elseif ( 'thumbnail' !== $target ) { |
|
943 $sizes = array_diff( $sizes, array( $target ) ); |
912 } |
944 } |
913 } |
945 } |
914 |
946 |
915 $return->fw = $meta['width']; |
947 $return->fw = $meta['width']; |
916 $return->fh = $meta['height']; |
948 $return->fh = $meta['height']; |
917 } elseif ( 'thumbnail' === $target ) { |
949 } elseif ( 'thumbnail' === $target ) { |
918 $sizes = array( 'thumbnail' ); |
950 $sizes = array( 'thumbnail' ); |
919 $success = true; |
951 $success = true; |
920 $delete = true; |
952 $delete = true; |
921 $nocrop = true; |
953 $nocrop = true; |
|
954 } else { |
|
955 $sizes = array( $target ); |
|
956 $success = true; |
|
957 $delete = true; |
|
958 $nocrop = $_wp_additional_image_sizes[ $size ]['crop']; |
922 } |
959 } |
923 |
960 |
924 /* |
961 /* |
925 * We need to remove any existing resized image files because |
962 * We need to remove any existing resized image files because |
926 * a new crop or rotate could generate different sizes (and hence, filenames), |
963 * a new crop or rotate could generate different sizes (and hence, filenames), |