Make WordPress Core


Ignore:
Timestamp:
06/18/2023 02:22:40 PM (8 months ago)
Author:
azaozz
Message:

Media: Deprecate the 'edit_custom_thumbnail_sizes' filter and disable the "Apply changes to [Thumbnail|All|All except thumbnail]" UI in the image editor. Add a (boolean) filter to reenable that UI.

Props peterwilsoncc, costdev, azaozz.
See: #57685.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/ajax/wpAjaxImageEditor.php

    r55859 r55935  
    2727        $this->remove_added_uploads();
    2828        parent::tear_down();
    29     }
    30 
    31     /**
    32      * @ticket 22985
    33      * @requires function imagejpeg
    34      *
    35      * @covers ::wp_insert_attachment
    36      * @covers ::wp_save_image
    37      */
    38     public function testCropImageThumbnail() {
    39         require_once ABSPATH . 'wp-admin/includes/image-edit.php';
    40 
    41         $filename = DIR_TESTDATA . '/images/canola.jpg';
    42         $contents = file_get_contents( $filename );
    43 
    44         $upload = wp_upload_bits( wp_basename( $filename ), null, $contents );
    45         $id     = $this->_make_attachment( $upload );
    46 
    47         $_REQUEST['action']  = 'image-editor';
    48         $_REQUEST['context'] = 'edit-attachment';
    49         $_REQUEST['postid']  = $id;
    50         $_REQUEST['target']  = 'thumbnail';
    51         $_REQUEST['do']      = 'save';
    52         $_REQUEST['history'] = '[{"c":{"x":5,"y":8,"w":289,"h":322}}]';
    53 
    54         $media_meta = wp_get_attachment_metadata( $id );
    55         $this->assertArrayHasKey( 'sizes', $media_meta, 'attachment should have size data' );
    56         $this->assertArrayHasKey( 'medium', $media_meta['sizes'], 'attachment should have data for medium size' );
    57         $ret = wp_save_image( $id );
    58 
    59         $media_meta = wp_get_attachment_metadata( $id );
    60         $this->assertArrayHasKey( 'sizes', $media_meta, 'cropped attachment should have size data' );
    61         $this->assertArrayHasKey( 'medium', $media_meta['sizes'], 'cropped attachment should have data for medium size' );
    6229    }
    6330
Note: See TracChangeset for help on using the changeset viewer.