Rotating image does not work for custom image sizes

When rotating an image with the WordPress image editor it creates new images and renames all of the images for the thumbnail, medium and large image sizes that are default for WordPress.

My problem is that I have registered new image sizes using add_image_size();

Read More

Is there anyway to make WordPress rename/rotate these custom image sizes?

If there is a way to just have it replace the original image names that would be great. So we don’t end up with strange image names like My_Image-e13232345234234-200×600.jpg.

EDIT

Below is a test plugin that shows this happening. Paste the code in a file in your plugins folder, then upload an image such as my_image.jpg. You should now have my_image-30xY.jpg. Now if your rotate the image you will get only 4 new images such as my_image-e1343232354234.jpg, but there will not be a new image for the “test” image size.

<?php

/*
Plugin Name: Test
Description: this is a test
Author: Mike
Version: .1
*/

class test{

    function __construct(){
    add_action( 'after_setup_theme', array($this, 'add_image_sizes') );
    }

    function add_image_sizes(){
    add_image_size( 'test', '30', '30' );
    }
}

new test();

?>

Related posts

Leave a Reply

2 comments

  1. From examination, it looks like a bug. I can’t think of a good reason it shouldn’t apply those changes.

    Reported: http://core.trac.wordpress.org/ticket/19889

    Patch in that ticket fixes the problem.

    Also, in response to your other question, you can define IMAGE_EDIT_OVERWRITE to true in the wp-config file to make it not create those oddly named files and to just overwrite the original names. This will break the “restore image” capability of the built in editor though.