Even I didn't understand what you mean saying "vertical images", getting only images from a directory is more simple in your case;
$images = glob('/path_of_images/*.{jpeg,jpg,png,gif}', GLOB_BRACE);
foreach ($images as $image) {
// so you can check the current image is image that you are looking for
$image_data = exif_read_data($image);
if ($image_data that im looking for)
printf('<img src="path_of_images/%s" alt=""><br>', basename($image));
// or check size
$image_size = getimagesize($image);
if ($image_size[0] > $image_size[1]) {
// this is landscape???
See more details here: http://php.net/manual/en/function.exif-read-data.php