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?
SVG is not supported by Intervention Image:
http://image.intervention.io/getting_started/formats
You can use ImageMagick to work with SVG.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With