Support » Plugins » how to replace “image_resize” core function??

  • Hello,

    I’m trying to change a core function named “image_resize”, around line 333 in /wp-includes/media.php with my own function, and although i can do it directly, i would like to do it using a filter.

    I need to generate thumbnails with the exact size defined on wp-admin, (120×90), BUT those images must be proportional, cannot be cropped and have the exact size of 120×90. So the solution is to add margins to it.

    I have done this by just editing the source on /wp-includes/media.php (and it works fine), however I would like to use add_filter instead of code editing.

    So I created a function with the changes i need inside functions.php and added:

    function crop_me {
    //my code here
    add_filter('image_resize', 'crop_me');

    Now my problem is, that it doesn’t work this way…
    When I try to upload images, the thumbnail keeps being cropped, so this function is not overwriting the core function.

    Can anyone point me a solution to replace that function with my own code?

  • The topic ‘how to replace “image_resize” core function??’ is closed to new replies.