Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: image_edit_thumbnails_separately

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

This hook occurs 2 times in this file.

Line Code
45      }
46
47      /**
48       * Shows the settings in the Image Editor that allow selecting to edit only the thumbnail of an image.
49       *
50       * @since 6.3.0
51       *
52       * @param bool $show Whether to show the settings in the Image Editor. Default false.
53       */
54      $edit_thumbnails_separately = (bool) apply_filters( 'image_edit_thumbnails_separately', false );
55
56      ?>
57      <div class="imgedit-wrap wp-clearfix">
58      <div id="imgedit-panel-<?php echo $post_id; ?>">
59      <?php echo $note; ?>
60      <div class="imgedit-panel-content imgedit-panel-tools wp-clearfix">
61           <div class="imgedit-menu wp-clearfix">
62                <button type="button" onclick="imageEdit.toggleCropTool( <?php echo "$post_id, '$nonce'"; ?>, this );" aria-expanded="false" aria-controls="imgedit-crop" class="imgedit-crop button disabled" disabled><?php esc_html_e( 'Crop' ); ?></button>
63                <button type="button" class="imgedit-scale button" onclick="imageEdit.toggleControls(this);" aria-expanded="false" aria-controls="imgedit-scale"><?php esc_html_e( 'Scale' ); ?></button>
 
Line Code
891           return $return;
892      }
893
894      $fwidth  = ! empty( $_REQUEST['fwidth'] ) ? (int) $_REQUEST['fwidth'] : 0;
895      $fheight = ! empty( $_REQUEST['fheight'] ) ? (int) $_REQUEST['fheight'] : 0;
896      $target  = ! empty( $_REQUEST['target'] ) ? preg_replace( '/[^a-z0-9_-]+/i', '', $_REQUEST['target'] ) : '';
897      $scale   = ! empty( $_REQUEST['do'] ) && 'scale' === $_REQUEST['do'];
898
899      /** This filter is documented in wp-admin/includes/image-edit.php */
900      $edit_thumbnails_separately = (bool) apply_filters( 'image_edit_thumbnails_separately', false );
901
902      if ( $scale ) {
903           $size = $img->get_size();
904           $sX   = $size['width'];
905           $sY   = $size['height'];
906
907           if ( $sX < $fwidth || $sY < $fheight ) {
908                $return->error = esc_js( __( 'Images cannot be scaled to a size larger than the original.' ) );
909                return $return;