• Resolved akv2

    (@akv2)


    Okay, so what I think is happening is that the Media Replace plugin is not quite as smart as it should be. We have a number of images that are named with the structure… house.png, house-door.png and house-door-window.png. When wordpress creates it’s different sizes it saves those out with dashes, so those three images would be house-103×100.png, house-door-103×100.png, and house-door-window-103×100.png.

    I think the plugin says, okay… you want to replace house.png so I’m going to delete house.png and all it’s sizes (house-X.png). In doing so, it deletes house-door.png (and it’s sizes) and house-door-window.png (and it’s sizes).

    Måns Jonasson, I should say that we really do appreciate this plugin and can’t find anything out that accomplishes the same task. This is something that people should be aware of as they move forward… and if what I described is not actually the cause of the issue, please let me know.

    http://wordpress.org/extend/plugins/enable-media-replace/

Viewing 3 replies - 1 through 3 (of 3 total)
  • akv2: It’s not quite that stupid, but almost. :-/

    The exakt deletion is:

    $prefix . “-*x*” . $suffix

    So if you upload a file called “image.jpg” it will delete all files matching “image-*x*.jpg”

    I agree that this is very stupid, but since WordPress lacks any way for me to find out what resized images DO exist, this is the closest I’ve gotten.

    If anybody knows of a way for me to improve on this method, please come forward!

    Måns, actually WP has that data stashed in the post_meta table. You can use wp_get_attachment_metadata to grab all existing sizes of an image, including custom sizes.

    Thanks John, for some reason that wasn’t working when I first developed the plugin, but I just tried it and it works now, so I’ll change the method for file deletion in the next version.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Deleting too many images (due to dimensions and naming)’ is closed to new replies.