From c73332fa45ce9fed2b7dd2c7b2de7155d2831247 Mon Sep 17 00:00:00 2001 From: Robert Reinhard Date: Mon, 8 Apr 2013 15:13:06 -0700 Subject: [PATCH] Don't replace with %20 when the filename isn't a URL --- src/GdThumb.inc.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/GdThumb.inc.php b/src/GdThumb.inc.php index 5393f2c..fe8edba 100644 --- a/src/GdThumb.inc.php +++ b/src/GdThumb.inc.php @@ -1470,7 +1470,9 @@ protected function determineFormat () } // According to php.net, getimagesize does not accept spaces in filenme. - $formatInfo = getimagesize(str_replace(' ','%20',$this->fileName)); + $filename = $this->fileName; + if (preg_match('#^https?//"#', $this->fileName)) $filename = str_replace(' ','%20', $filename); + $formatInfo = getimagesize($filename); // non-image files will return false if ($formatInfo === false)