| 
 //lấy địa chỉ ảnh full. 
wp_get_attachment_url( get_post_thumbnail_id($post->ID) );    
  
//get image attributes 
wp_get_attachment_image_src($attachment_id, 'full'); 
     ->result: [0] => url 
     [1] => width 
     [2] => height 
     [3] => boolean: true if $url is a resized image, false if it is the original or if no image is available. 
  
//Returns an HTML image element: syntax: wp_get_attachment_image( $attachment_id, $size, $icon, $attr ); 
echo wp_get_attachment_image( $attachment->ID, 'full' ); 
//img tag bởi id 
echo wp_get_attachment_image('34');      //<img src="" title="..".. 
  
//lấy ảnh bởi id 
get_media_item('2'); 
  
//lấy metadata của ảnh bởi id 
wp_get_attachment_metadata('34');   //array(..) 
->result: 
Array 
   ( 
       [width] => 2400 
       [height] => 1559 
       [file] => 2011/12/press_image.jpg 
       [sizes] => Array 
           ( 
               [thumbnail] => Array 
                   ( 
                       [file] => press_image-150x150.jpg 
                       [width] => 150 
                       [height] => 150 
                       [mime-type] => image/jpeg 
                   ) 
               [medium] => Array 
                   ( 
                       [file] => press_image-4-300x194.jpg 
                       [width] => 300 
                       [height] => 194 
                       [mime-type] => image/jpeg 
                   ) 
               [large] => Array 
                   ( 
                       [file] => press_image-1024x665.jpg 
                       [width] => 1024 
                       [height] => 665 
                       [mime-type] => image/jpeg 
                   ) 
               [post-thumbnail] => Array 
                   ( 
                       [file] => press_image-624x405.jpg 
                       [width] => 624 
                       [height] => 405 
                       [mime-type] => image/jpeg 
                   ) 
           ) 
       [image_meta] => Array 
           ( 
               [aperture] => 5 
               [credit] => 
               [camera] => Canon EOS-1Ds Mark III 
               [caption] => 
               [created_timestamp] => 1323190643 
               [copyright] => 
               [focal_length] => 35 
               [iso] => 800 
               [shutter_speed] => 0.016666666666667 
               [title] => 
           ) 
   ) 
 |