I have a function that returns all the images in WordPress media library, but the problem is that it doesn't return all the image sizes of the image, ex: (thumbnail, small, large), it only returns the original image.
function get_images_highcompress_data()
{
$args = array(
'post_type' => 'attachment',
'post_mime_type' => 'image/jpeg,image/jpg,image/png',
'post_status' => 'inherit',
'posts_per_page' => -1,
'orderby' => 'id',
'order' => 'ASC'
);
$query_images = new WP_Query( $args );
$images = array();
foreach ( $query_images->posts as $image) {
$images[]= $image->guid;
}
Is there any other function that can get all images URL from the wp media library with all its sizes.
Eg. Image01.jpg
, image01-500X500.jpg
, Image01-1080X1080.jpg
, Image02.jpg
, image02-500X500.jpg
, Image02-1080X1080.jpg
Like this in one single array.