mime_content_type

Supported Versions: PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8
Detect MIME Content-type for a file
<?php mime_content_type(resource|string $filename): string|false
<?php         $this->assertSame(20, $info[1]);

        $this->assertSame(

            'image/jpeg',

            mime_content_type($jpg->getRealPath())

        );

    }
<?php         $this->assertSame(

            'image/gif',

            mime_content_type($image->getRealPath())

        );

    }
<?php         $this->assertSame(

            'image/webp',

            mime_content_type($image->getRealPath())

        );

    }
<?php         $imagePath = $image->getRealPath();



        if (version_compare(PHP_VERSION, '8.3.0-dev', '>=')) {

            $this->assertSame('image/bmp', mime_content_type($imagePath));

        } else {

            $this->assertSame('image/x-ms-bmp', mime_content_type($imagePath));

        }
<?php         if (version_compare(PHP_VERSION, '8.3.0-dev', '>=')) {

            $this->assertSame('image/bmp', mime_content_type($imagePath));

        } else {

            $this->assertSame('image/x-ms-bmp', mime_content_type($imagePath));

        }

    }
<?php         $this->assertEquals($gifCore->getImageMimeType(), 'image/gif');

        $image->save($save_as, null, 'jpg');



        $this->assertEquals(\mime_content_type($save_as), 'image/jpeg');

        @unlink($save_as);

    }