From 8fde624a822a1c9b6678288d62117e343f89aa5e Mon Sep 17 00:00:00 2001 From: Alexander Cogneau Date: Tue, 6 Aug 2013 10:06:24 +0200 Subject: [PATCH 1/2] Fix missing RuntimeException class error Signed-off-by: Alexander Cogneau --- src/PHPThumb/GD.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/PHPThumb/GD.php b/src/PHPThumb/GD.php index 350bf19..ff66425 100644 --- a/src/PHPThumb/GD.php +++ b/src/PHPThumb/GD.php @@ -771,7 +771,7 @@ public function rotateImageNDegrees($degrees) } if (!function_exists('imagerotate')) { - throw new \RuntimeException('Your version of GD does not support image rotation'); + throw new \\RuntimeException('Your version of GD does not support image rotation'); } $this->workingImage = imagerotate($this->oldImage, $degrees, 0); @@ -798,7 +798,7 @@ public function imageFilter($filter, $arg1 = false, $arg2 = false, $arg3 = false } if (!function_exists('imagefilter')) { - throw new \RuntimeException('Your version of GD does not support image filters'); + throw new \\RuntimeException('Your version of GD does not support image filters'); } $result = false; @@ -815,7 +815,7 @@ public function imageFilter($filter, $arg1 = false, $arg2 = false, $arg3 = false } if (!$result) { - throw new \RuntimeException('GD imagefilter failed'); + throw new \\RuntimeException('GD imagefilter failed'); } $this->workingImage = $this->oldImage; @@ -844,7 +844,7 @@ public function show($rawData = false) } if (headers_sent() && php_sapi_name() != 'cli') { - throw new \RuntimeException('Cannot show image, headers have already been sent'); + throw new \\RuntimeException('Cannot show image, headers have already been sent'); } // When the interlace option equals true or false call imageinterlace else leave it to default @@ -905,7 +905,7 @@ public function getImageAsString() * * If the target directory is not writeable, the function will try to correct the permissions (if allowed, this * is set as an option ($this->options['correctPermissions']). If the target cannot be made writeable, then a - * \RuntimeException is thrown. + * \\RuntimeException is thrown. * * @param string $fileName The full path and filename of the image to save * @param string $format The format to save the image in (optional, must be one of [GIF,JPG,PNG] @@ -928,10 +928,10 @@ public function save($fileName, $format = null) // throw an exception if not writeable if (!is_writeable(dirname($fileName))) { - throw new \RuntimeException("File is not writeable, and could not correct permissions: {$fileName}"); + throw new \\RuntimeException("File is not writeable, and could not correct permissions: {$fileName}"); } } else { // throw an exception if not writeable - throw new \RuntimeException("File not writeable: {$fileName}"); + throw new \\RuntimeException("File not writeable: {$fileName}"); } } From d359a2fcf3bdd89e5b9a91ac408dc5313796c789 Mon Sep 17 00:00:00 2001 From: AlexCogn Date: Tue, 6 Aug 2013 10:09:53 +0200 Subject: [PATCH 2/2] Fix double \\ --- src/PHPThumb/GD.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/PHPThumb/GD.php b/src/PHPThumb/GD.php index ff66425..350bf19 100644 --- a/src/PHPThumb/GD.php +++ b/src/PHPThumb/GD.php @@ -771,7 +771,7 @@ public function rotateImageNDegrees($degrees) } if (!function_exists('imagerotate')) { - throw new \\RuntimeException('Your version of GD does not support image rotation'); + throw new \RuntimeException('Your version of GD does not support image rotation'); } $this->workingImage = imagerotate($this->oldImage, $degrees, 0); @@ -798,7 +798,7 @@ public function imageFilter($filter, $arg1 = false, $arg2 = false, $arg3 = false } if (!function_exists('imagefilter')) { - throw new \\RuntimeException('Your version of GD does not support image filters'); + throw new \RuntimeException('Your version of GD does not support image filters'); } $result = false; @@ -815,7 +815,7 @@ public function imageFilter($filter, $arg1 = false, $arg2 = false, $arg3 = false } if (!$result) { - throw new \\RuntimeException('GD imagefilter failed'); + throw new \RuntimeException('GD imagefilter failed'); } $this->workingImage = $this->oldImage; @@ -844,7 +844,7 @@ public function show($rawData = false) } if (headers_sent() && php_sapi_name() != 'cli') { - throw new \\RuntimeException('Cannot show image, headers have already been sent'); + throw new \RuntimeException('Cannot show image, headers have already been sent'); } // When the interlace option equals true or false call imageinterlace else leave it to default @@ -905,7 +905,7 @@ public function getImageAsString() * * If the target directory is not writeable, the function will try to correct the permissions (if allowed, this * is set as an option ($this->options['correctPermissions']). If the target cannot be made writeable, then a - * \\RuntimeException is thrown. + * \RuntimeException is thrown. * * @param string $fileName The full path and filename of the image to save * @param string $format The format to save the image in (optional, must be one of [GIF,JPG,PNG] @@ -928,10 +928,10 @@ public function save($fileName, $format = null) // throw an exception if not writeable if (!is_writeable(dirname($fileName))) { - throw new \\RuntimeException("File is not writeable, and could not correct permissions: {$fileName}"); + throw new \RuntimeException("File is not writeable, and could not correct permissions: {$fileName}"); } } else { // throw an exception if not writeable - throw new \\RuntimeException("File not writeable: {$fileName}"); + throw new \RuntimeException("File not writeable: {$fileName}"); } }