Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Get the size of an image
<?php getimagesize(string $filename, array &$image_info = null): array|false
<?php     public function dimensions()

    {

        return @getimagesize($this->getRealPath());

    }

}
<?php         $dimensions = method_exists($value, 'dimensions')

                ? $value->dimensions()

                : @getimagesize($value->getRealPath());



        if (! $dimensions) {

            return false;
<?php         $image = (new FileFactory)->image('test.png', 15, 20);



        $info = getimagesize($image->getRealPath());



        $this->assertSame('image/png', $info['mime']);

        $this->assertSame(15, $info[0]);
<?php         $jpeg = (new FileFactory)->image('test.jpeg', 15, 20);

        $jpg = (new FileFactory)->image('test.jpg');



        $info = getimagesize($jpeg->getRealPath());



        $this->assertSame('image/jpeg', $info['mime']);

        $this->assertSame(15, $info[0]);
<?php         $this->assertSame(

            'image/vnd.wap.wbmp',

            getimagesize($image->getRealPath())['mime']

        );

    }