mirror of
https://github.com/Intervention/image.git
synced 2025-08-21 13:11:18 +02:00
Improve code
This commit is contained in:
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||||||
namespace Intervention\Image\Drivers\Gd\Analyzers;
|
namespace Intervention\Image\Drivers\Gd\Analyzers;
|
||||||
|
|
||||||
use Intervention\Image\Analyzers\ResolutionAnalyzer as GenericResolutionAnalyzer;
|
use Intervention\Image\Analyzers\ResolutionAnalyzer as GenericResolutionAnalyzer;
|
||||||
|
use Intervention\Image\Exceptions\RuntimeException;
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
use Intervention\Image\Interfaces\SpecializedInterface;
|
use Intervention\Image\Interfaces\SpecializedInterface;
|
||||||
use Intervention\Image\Resolution;
|
use Intervention\Image\Resolution;
|
||||||
@@ -18,6 +19,12 @@ class ResolutionAnalyzer extends GenericResolutionAnalyzer implements Specialize
|
|||||||
*/
|
*/
|
||||||
public function analyze(ImageInterface $image): mixed
|
public function analyze(ImageInterface $image): mixed
|
||||||
{
|
{
|
||||||
return new Resolution(...imageresolution($image->core()->native()));
|
$result = imageresolution($image->core()->native());
|
||||||
|
|
||||||
|
if (!is_array($result)) {
|
||||||
|
throw new RuntimeException('Unable to read image resolution.');
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Resolution(...$result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user