Fixed Class "http\Exception\BadUrlException" not found exception

This commit is contained in:
2024-03-25 15:47:20 +03:00
parent 1baf7ae2ca
commit 178c158618
+2 -3
View File
@@ -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");