Open duongsieu opened 4 years ago
Please when opening an issue state the full version as the issue template suggests:
- Laravel: v#.#.#
- Voyager: v#.#.#
As the error says GD driver doesn't support SVG files, it's not a bug and it doesn't depend from Voyager. You can try to change your driver to imagick, if you have it installed, in config/image.php.
http://image.intervention.io/getting_started/configuration
php artisan vendor:publish --provider="Intervention\Image\ImageServiceProviderLaravelRecent"
I also get this issue with Voyager Settings replacing the admin loader with svg file.
SVG doesn't need to be resized or supported by Intervention. Even with Imagick it throws error: https://github.com/Intervention/image/issues/52
Problem is because there's no validation of mime types in: Http/Controllers/ContentTypes/Image.php
I can't find any Intervention validation method but this is how they're doing it
// get mime type of file
$mime = finfo_file(finfo_open(FILEINFO_MIME_TYPE), $path);
// define core
switch (strtolower($mime)) {
case 'image/png':
case 'image/x-png':
case 'image/jpg':
case 'image/jpeg':
case 'image/pjpeg':
case 'image/gif':
case 'image/webp':
case 'image/x-webp':
}
@MrCrayon I've added a check for the mime type before resizing the image and allows SVG to be uploaded. Could you please check I've committed it correctly. https://github.com/the-control-group/voyager/commit/ea9c21577d885a9afdbfb15416ac92be627779c9
The following could also help: Define the allowed_mimetypes in the voyager config file, 'voyager.php' as below: 'allowed_mimetypes' => '*', //All types can be uploaded
When I'm trying to upload images with .svg extension voyager I have this message: Unsupported image type. GD driver is only able to decode JPG, PNG, GIF or WebP files.