Skip to main content
3 of 3
replaced http://wordpress.stackexchange.com/ with https://wordpress.stackexchange.com/

Calling image_resize() would be difficult, since it would search for the image in your main blog's upload directory. If it is a fixed image size I would just add it to the configuration of your photoblog, so it is created there when you upload new images (you can then rebuild your old image thumbnails).

In Mike's answer you see that he adds the <img src=" and "/> parts in the SQL query. That's nice, but you don't have to do that. If you leave that off you get just the URL of the image and you can add everything later in PHP. I wrote an alternative version that will provide you with more raw information to play with.

$attachment_data_list = $wpdb->get_results( $sql );
if ( $attachment_data_list ) {
    foreach ( $attachment_data_list as $attachment_data ) {
        echo '<img src="/mysubblog/wp-content/uploads/';
        echo $attachment_data->upload_relative_path;
        echo '"/>';
    }
}
Jan Fabry
  • 30.5k
  • 4
  • 90
  • 136