getimagesize

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     {

        stream_copy_to_stream($this->storage->readStream($this->path), $tmpFile = tmpfile());



        return @getimagesize(stream_get_meta_data($tmpFile)['uri']);

    }



    public function temporaryUrl()
<?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']

        );

    }
<?php         $key = $this->argument(0)->value();



        $info = [];

        @getimagesize($image->dirname .'/'. $image->basename, $info);



        $data = [];
<?php         $manager->copy("source://{$this->asset->path()}", $destination);



        try {

            $size = getimagesize($cache->getAdapter()->getPathPrefix().$cachePath);

        } catch (\Exception $e) {

            $size = [0, 0];

        } finally {
<?php             if ($this->isResizable($item)) {

                $path = $this->generateImage($item);



                [$width, $height] = getimagesize($this->getServer()->getCache()->getAdapter()->getPathPrefix().$path);



                $data['width'] = $width;

                $data['height'] = $height;
<?php         $realpath = Storage::disk('test')->getAdapter()->getPathPrefix().'path/to/asset.jpg';

        $this->assertFileExists($realpath);

        $imagesize = getimagesize($realpath);

        $this->assertEquals([30, 60], array_splice($imagesize, 0, 2));



        $dimensions = $this->dimensions->asset($asset);