1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-22 05:22:50 +02:00

Improve code

This commit is contained in:
Oliver Vogel
2025-08-03 10:40:43 +02:00
parent 8bfadfea5c
commit f5c3dc4a70

View File

@@ -5,6 +5,7 @@ declare(strict_types=1);
namespace Intervention\Image\Drivers\Gd\Analyzers;
use Intervention\Image\Analyzers\ResolutionAnalyzer as GenericResolutionAnalyzer;
use Intervention\Image\Exceptions\RuntimeException;
use Intervention\Image\Interfaces\ImageInterface;
use Intervention\Image\Interfaces\SpecializedInterface;
use Intervention\Image\Resolution;
@@ -18,6 +19,12 @@ class ResolutionAnalyzer extends GenericResolutionAnalyzer implements Specialize
*/
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);
}
}