WordPress.org

Make WordPress Core


Ignore:
Timestamp:
09/24/2009 01:54:07 AM (10 years ago)
Author:
azaozz
Message:

Image Editor improvements, see #10528

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/post.php

    r11947 r11965  
    25762576    delete_post_meta($post_id, '_wp_trash_meta_time');
    25772577
    2578     $meta = wp_get_attachment_metadata( $post_id, false, false );
     2578    $meta = wp_get_attachment_metadata( $post_id );
     2579    $backup_sizes = get_post_meta( $post->ID, '_wp_attachment_backup_sizes', true );
    25792580    $file = get_attached_file( $post_id );
    25802581
     
    26102611    }
    26112612
    2612     if ( isset($meta['sizes']) && is_array($meta['sizes']) ) {
    2613         foreach ( array_keys($meta['sizes']) as $size ) {
    2614             if ( preg_match('/backup-[0-9]+/', $size) ) { // make sure this is a backup
    2615                 if ( $del = image_get_intermediate_size($post_id, $size) ) {
    2616                     $del_file = apply_filters('wp_delete_file', $del['path']);
    2617                     @ unlink( path_join($uploadpath['basedir'], $del_file) );
    2618                 }
    2619             }
     2613    if ( is_array($backup_sizes) ) {
     2614        foreach ( $backup_sizes as $size ) {
     2615            $del_file = path_join( dirname($meta['file']), $size['file'] );
     2616            $del_file = apply_filters('wp_delete_file', $del_file);
     2617            @ unlink( path_join($uploadpath['basedir'], $del_file) );
    26202618        }
    26212619    }
     
    26402638 * @return string|bool Attachment meta field. False on failure.
    26412639 */
    2642 function wp_get_attachment_metadata( $post_id, $unfiltered = false, $remove_backups = true ) {
     2640function wp_get_attachment_metadata( $post_id, $unfiltered = false ) {
    26432641    $post_id = (int) $post_id;
    26442642    if ( !$post =& get_post( $post_id ) )
     
    26462644
    26472645    $data = get_post_meta( $post->ID, '_wp_attachment_metadata', true );
    2648 
    2649     if ( $remove_backups && isset($data['sizes']) && is_array($data['sizes']) ) {
    2650         $sizes = apply_filters( 'intermediate_image_sizes', array('large', 'medium', 'thumbnail') );
    2651         foreach ( $data['sizes'] as $size => $val ) {
    2652             if ( !in_array( $size, $sizes, true ) )
    2653                 unset($data['sizes'][$size]);
    2654         }
    2655     }
    26562646
    26572647    if ( $unfiltered )
Note: See TracChangeset for help on using the changeset viewer.