Remove intermediate images when deleting an attachment. Props tellyworth. fixes #6142

git-svn-id: http://svn.automattic.com/wordpress/trunk@7271 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan
2008-03-12 23:15:31 +00:00
parent 2e439f5810
commit 6d0fa72e1d
2 changed files with 20 additions and 3 deletions
+9
View File
@@ -2180,6 +2180,15 @@ function wp_delete_attachment($postid) {
}
}
// remove intermediate images if there are any
$sizes = apply_filters('intermediate_image_sizes', array('thumbnail', 'medium'));
foreach ( $sizes as $size ) {
if ( $intermediate = image_get_intermediate_size($postid, $size) ) {
$intermediate_file = apply_filters('wp_delete_file', $intermediate['path']);
@ unlink($intermediate_file);
}
}
$file = apply_filters('wp_delete_file', $file);
if ( ! empty($file) )