[wp-trac] [WordPress Trac] #40415: Imagick resize filter hook

WordPress Trac noreply at wordpress.org
Fri Jan 28 00:54:09 UTC 2022


#40415: Imagick resize filter hook
-------------------------------------------------+-------------------------
 Reporter:  virgodesign                          |       Owner:  (none)
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  6.0
Component:  Media                                |     Version:  4.7.3
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch needs-testing reporter-    |     Focuses:
  feedback                                       |
-------------------------------------------------+-------------------------

Comment (by galbaras):

 How about adding a filter for which functions to use? The filter can
 evaluate to `1` or `true` for using `adaptiveResizeImage()` (`0` or
 `false` being the default), or it can be evaluated to the string
 `adaptiveResizeImage` (with `resizeImage` being the default).

 Alternatively, the function `resizeImage()` can be wrapped inside
 something like `wp_resize_image()`, which will be used for resizing
 images, so that it can be superseded, likes this:

 {{{#!php
 <?php

 if ( ! function_exists( 'wp_resize_image' ) ) {
     function wp_resize_image( $this, ARGUMENTS ) {
         $this->image->resizeImage( ARGUMENTS );
     }
 }
 }}}

 ARGUMENTS should be elaborated, of course.

 This way, developers can override this function with a call to
 `adaptiveResizeImage()` if that's what they prefer.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/40415#comment:27>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list