Make WordPress Core


Ignore:
Timestamp:
12/05/2006 10:37:19 PM (18 years ago)
Author:
ryan
Message:

Attachment data abstraction from mdawaffe. fixes #3440

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/upload-functions.php

    r4466 r4612  
    33    global $post;
    44    $id = get_the_ID();
    5     $attachment_data = get_post_meta( $id, '_wp_attachment_metadata', true );
     5    $attachment_data = wp_get_attachment_metadata( $id );
    66    if ( isset($attachment_data['width']) )
    77        list($width,$height) = wp_shrink_dimensions($attachment_data['width'], $attachment_data['height'], 171, 128);
     
    5858    global $style, $post_id, $style;
    5959    $id = get_the_ID();
    60     $attachment_data = get_post_meta( $id, '_wp_attachment_metadata', true );
     60    $attachment_data = wp_get_attachment_metadata( $id );
    6161?>
    6262    <div id="upload-file">
     
    9999    if ( $id ) :
    100100        $attachment = get_post_to_edit( $id );
    101         $attachment_data = get_post_meta( $id, '_wp_attachment_metadata', true );
     101        $attachment_data = wp_get_attachment_metadata( $id );
    102102?>
    103103        <div id="file-title">
     
    230230            $imagedata['file'] = $file;
    231231
    232             add_post_meta($id, '_wp_attachment_metadata', $imagedata);
     232            wp_update_attachment_metadata( $id, $imagedata );
    233233
    234234            if ( $imagedata['width'] * $imagedata['height'] < 3 * 1024 * 1024 ) {
     
    241241                    $newdata = $imagedata;
    242242                    $newdata['thumb'] = basename($thumb);
    243                     update_post_meta($id, '_wp_attachment_metadata', $newdata, $imagedata);
     243                    wp_update_attachment_metadata( $id, $newdata );
    244244                } else {
    245245                    $error = $thumb;
     
    247247            }
    248248        } else {
    249             add_post_meta($id, '_wp_attachment_metadata', array());
     249            wp_update_attachment_metadata( $id, array() );
    250250        }
    251251
Note: See TracChangeset for help on using the changeset viewer.