mirror of
https://github.com/Geckon01/simple-image-compressor.git
synced 2026-06-17 00:37:50 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| dca7db5442 | |||
| 178c158618 |
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "geckon01/simple-image-compressor",
|
"name": "geckon01/simple-image-compressor",
|
||||||
"description": "SimpleImageCompressor is a tiny simple PHP image compressor lib which allows you to compress any image easily on the fly",
|
"description": "SimpleImageCompressor is a tiny simple PHP image compressor lib which allows you to compress any image easily on the fly",
|
||||||
"version": "0.3.10.17",
|
"version": "0.4.3.25",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"php",
|
"php",
|
||||||
"images",
|
"images",
|
||||||
|
|||||||
@@ -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