mirror of
https://github.com/Geckon01/simple-image-compressor.git
synced 2026-07-12 04:22:06 +00:00
Fixed Class "http\Exception\BadUrlException" not found exception
This commit is contained in:
@@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
namespace geckon01\SimpleImageCompressor;
|
namespace geckon01\SimpleImageCompressor;
|
||||||
|
|
||||||
use http\Exception\BadUrlException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class SimpleImageCompressor
|
* Class SimpleImageCompressor
|
||||||
@@ -135,7 +134,7 @@ class SimpleImageCompressor
|
|||||||
$imageData = file_get_contents($this->imageResourceUrl);
|
$imageData = file_get_contents($this->imageResourceUrl);
|
||||||
|
|
||||||
if($imageData === false)
|
if($imageData === false)
|
||||||
throw new BadUrlException("Cannot load image from provided resource: ".$this->imageResourceUrl);
|
throw new \Exception("Cannot load image from provided resource: ".$this->imageResourceUrl);
|
||||||
|
|
||||||
$this->imageData = $imageData;
|
$this->imageData = $imageData;
|
||||||
}
|
}
|
||||||
@@ -150,7 +149,7 @@ class SimpleImageCompressor
|
|||||||
public function resizeAndCompress($reductionPercent = 5, $quality = 90): CompressedImage
|
public function resizeAndCompress($reductionPercent = 5, $quality = 90): CompressedImage
|
||||||
{
|
{
|
||||||
$originImage = imagecreatefromstring($this->imageData);
|
$originImage = imagecreatefromstring($this->imageData);
|
||||||
|
|
||||||
if($originImage === false)
|
if($originImage === false)
|
||||||
throw new \Exception("Can not read provided file");
|
throw new \Exception("Can not read provided file");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user