I had asked a question earlier, on getting post-thumbnails from another WP-site. There, the awesome Mike coded a SQL query whose results are then passes on to a PHP array. The piece of code from that answer that I want to modify is this.
$post_urls = $wpdb->get_col($sql);
if (is_array($post_urls))
echo implode("\n",$post_urls);
Now the array holds values in the form of <img src="/link/to/image.jpg"/>
. Now how do I..
- Call the WP
image_resize
function on each image URL? - Apply my own CSS class to each image?
UPDATE:
Thanks to Jan for the tips on optimizing the SQL query. Now the $post_urls
array will hold only plain URLs to the images. Can someone show me how to loop through each URL in the array and add prefixes (like <img src="
) and suffixes (like " class="awesome-image"/>
) to each of them?