I'm using the following script for my current project.
$query_images_args = array(
'post_type' => 'attachment',
'post_mime_type' =>'image',
'post_status' => 'inherit',
'posts_per_page' => -1
);
$query_images = new WP_Query( $query_images_args );
$images = array();
foreach ( $query_images->posts as $image) {
$images[]= wp_get_attachment_url( $image->ID );
}
This saves all image paths of the current post or page into an array. And right now the paths are set to the "original" uploaded file.
Is it possible to have a parameter that specifies that I want to save the largest file-size wordpress generates (with its settings in media) to that array?
So when uploading an image to WP the following happens …
image-150x150.jpg
image-300x247.jpg
image-1024x843.jpg
image.jpg
Those four images are inside my uploads folder when I leave the default settings of the media uploader. And with my script above "image.jpg" gets pushed into the array. However I want the largest generated size in my array - in this case image-1025x843.jpg.
Is that possible?