summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2009-05-24 09:19:28 +0000
committerBharat Mediratta <bharat@menalto.com>2009-05-24 09:19:28 +0000
commit32a2100217115e0cc0776d936df7b19965455f2a (patch)
tree89d889229d0ae7d6110bfc494dca3b43a8027459 /core
parent7e3705540875ac30e9610c5a608fe74399afd2b0 (diff)
Make img_dimensions() return early if the width or height is zero (probably a broken image).
Diffstat (limited to 'core')
-rw-r--r--core/helpers/photo.php4
1 files changed, 4 insertions, 0 deletions
diff --git a/core/helpers/photo.php b/core/helpers/photo.php
index 9e468116..c1c005f5 100644
--- a/core/helpers/photo.php
+++ b/core/helpers/photo.php
@@ -155,6 +155,10 @@ class photo_Core {
* @param string $format the output format using %d placeholders for width and height
*/
static function img_dimensions($width, $height, $max, $format="width=\"%d\" height=\"%d\"") {
+ if (!$width || !$height) {
+ return "";
+ }
+
if ($width > $height) {
$new_width = $max;
$new_height = (int)$max * ($height / $width);