From 00e5822e17843fe97169db68ed6076d98c1d46ad Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Thu, 29 Apr 2004 04:42:52 +0000 Subject: [PATCH] Don't create thumbnail images larger than the image; use the source image itself if asked. Reject attempts at zero or negative-width thumbs. --- includes/Image.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/includes/Image.php b/includes/Image.php index 27ad21e326..ed69912a61 100644 --- a/includes/Image.php +++ b/includes/Image.php @@ -103,6 +103,17 @@ class Image # If there is no image, there will be no thumbnail return ""; } + + # Sanity check $width + $width = IntVal( $width ); + if( $width <= 0 ) { + # BZZZT + return ""; + } + if( $width > $this->width ) { + # Don't make an image bigger than the source + return $this->getURL(); + } if ( (! file_exists( $thumbPath ) ) || ( filemtime($thumbPath) < filemtime($this->imagePath) ) ) { -- 2.20.1