From 82b5f9e128fa416e2c073e1e430dee7602459df6 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Fri, 8 Mar 2013 16:13:15 +0000 Subject: [PATCH] Add orientation information to gallery items. props obenland. fixes #23695. git-svn-id: https://develop.svn.wordpress.org/trunk@23649 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/media.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wp-includes/media.php b/wp-includes/media.php index c543389a97..9ef641cd3f 100644 --- a/wp-includes/media.php +++ b/wp-includes/media.php @@ -778,10 +778,12 @@ function gallery_shortcode($attr) { $i = 0; foreach ( $attachments as $id => $attachment ) { $link = isset($attr['link']) && 'file' == $attr['link'] ? wp_get_attachment_link($id, $size, false, false) : wp_get_attachment_link($id, $size, true, false); + $image_meta = wp_get_attachment_metadata( $id ); + $orientation = ( $image_meta['height'] > $image_meta['width'] ) ? 'portrait' : 'landscape'; $output .= "<{$itemtag} class='gallery-item'>"; $output .= " - <{$icontag} class='gallery-icon'> + <{$icontag} class='gallery-icon {$orientation}'> $link "; if ( $captiontag && trim($attachment->post_excerpt) ) {