[wp-trac] [WordPress Trac] #11101: Gallery column width calculation needs more granularity
WordPress Trac
wp-trac at lists.automattic.com
Sun Nov 8 07:36:14 UTC 2009
#11101: Gallery column width calculation needs more granularity
-------------------------+--------------------------------------------------
Reporter: akozak | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Unassigned
Component: Gallery | Version:
Severity: minor | Keywords:
-------------------------+--------------------------------------------------
In line 712 of wp-includes/media.php where the column width is calculated
for the gallery css snippet:
{{{
$columns = intval($columns);
$itemwidth = $columns > 0 ? floor(100/$columns) : 100;
$selector = "gallery-{$instance}";
$output = apply_filters('gallery_style', "
<style type='text/css'>
#{$selector} {
margin: auto;
}
#{$selector} .gallery-item {
float: left;
margin-top: 10px;
text-align: center;
width: {$itemwidth}%; }
}}}
itemwidth should be calculated as
{{{
$itemwidth = $columns > 0 ? round(100/$columns,1) : 100;
}}}
This gives the width better precision. I've read that IE ignores the
decimal, but it works on at least Firefox, so there is no reason not to
let it have a decimal value. You could even increase the number of decimal
points.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/11101>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list