Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Unable to read image" error while uploading svg image in laravel 4

I have code which working ok for jpg,png images to resize images, here is the code sample.

$image = Image::make("{$filePath}/{$fileName[0]}");
// Get the maximum uploaded image width
$maxWidth = Config::get('constants.max_uploaded_image_width');

// Resize the image
$image->resize($maxWidth, null, function($constraint)
{
    // Set an aspect ratio constraint
    $constraint->aspectRatio();

    // Prevent upsizing
    $constraint->upsize();
});

// Save the image
$image->save("{$filePath}/{$fileName[0]}");

This one is working great with jpg and png images, but when i am using svg it will return error like Unable to read image from file. Any solution?

like image 939
Himanshu Bhardiya Avatar asked May 31 '26 19:05

Himanshu Bhardiya


1 Answers

SVG is not supported by Intervention Image:

http://image.intervention.io/getting_started/formats

You can use ImageMagick to work with SVG.

like image 124
Alexey Mezenin Avatar answered Jun 02 '26 09:06

Alexey Mezenin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!