Index: trunk/phase3/includes/ImageFunctions.php |
— | — | @@ -5,7 +5,7 @@ |
6 | 6 | * |
7 | 7 | * @param $length String: CSS/SVG length. |
8 | 8 | * @param $viewpoerSize: Float optional scale for percentage units... |
9 | | - * @return Integer: length in pixels |
| 9 | + * @return float: length in pixels |
10 | 10 | */ |
11 | 11 | function wfScaleSVGUnit( $length, $viewportSize=512 ) { |
12 | 12 | static $unitLength = array( |
— | — | @@ -24,13 +24,13 @@ |
25 | 25 | $length = floatval( $matches[1] ); |
26 | 26 | $unit = $matches[2]; |
27 | 27 | if( $unit == '%' ) { |
28 | | - return round( $length * 0.01 * $viewportSize ); |
| 28 | + return $length * 0.01 * $viewportSize; |
29 | 29 | } else { |
30 | | - return round( $length * $unitLength[$unit] ); |
| 30 | + return $length * $unitLength[$unit]; |
31 | 31 | } |
32 | 32 | } else { |
33 | 33 | // Assume pixels |
34 | | - return round( floatval( $length ) ); |
| 34 | + return floatval( $length ); |
35 | 35 | } |
36 | 36 | } |
37 | 37 | |
— | — | @@ -76,8 +76,11 @@ |
77 | 77 | $width = $height * $aspect; |
78 | 78 | } |
79 | 79 | |
80 | | - $this->width = $width; |
81 | | - $this->height = $height; |
| 80 | + if( $width > 0 && $height > 0 ) { |
| 81 | + $this->width = intval( round( $width ) ); |
| 82 | + $this->height = intval( round( $height ) ); |
| 83 | + } |
| 84 | + |
82 | 85 | $this->first = false; |
83 | 86 | } |
84 | 87 | } |