app/Http/Controllers/MediaFileController.php
private function fileExtensionAsImage(string $extension): ResponseInterface
    {
        $extension = '.' . strtolower($extension);

        $svg = '<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"><rect width="100" height="100" fill="#88F" /><text x="5" y="60" font-family="Verdana" font-size="30">' . $extension . '</text></svg>';

        return response($svg, StatusCodeInterface::STATUS_OK, [
            'Content-Type'   => 'image/svg+xml',
            'Content-Length' => strlen($svg),
        ]);
    }
private function fileExtensionAsImage(string $extension): ResponseInterface
    {
        $extension = '.' . strtolower($extension);

        $svg = '<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"><rect width="100" height="100" fill="#88F" /><text x="5" y="60" font-family="Verdana" font-size="30">' . $extension . '</text></svg>';

        return response($svg, StatusCodeInterface::STATUS_OK, [
            'Content-Type'   => 'image/svg+xml',
            'Content-Length' => strlen($svg),
        ]);
    }
private function fileExtensionAsImage ( string $ extension ) : ResponseInterface { $ extension = '.' . strtolower ( $ extension ) ; $ svg = '<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"><rect width="100" height="100" fill="#88F" /><text x="5" y="60" font-family="Verdana" font-size="30">' . $ extension . '</text></svg>' ; return response ( $ svg , StatusCodeInterface :: STATUS_OK , [ 'Content-Type' => 'image/svg+xml' , 'Content-Length' => strlen ( $ svg ) , ] ) ; }
Send a dummy image, to replace a non-image file.

@param string $extension

@return ResponseInterface
Send a dummy image to replace a non - image file .