【发布时间】:2016-07-13 22:31:32
【问题描述】:
我的代码可以用于 jpg、png 图像来调整图像大小,这里是代码示例。
$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]}");
这个与jpg 和png 图像配合得很好,但是当我使用svg 时,它会返回类似Unable to read image from file 的错误。有什么解决办法吗?
【问题讨论】:
标签: php laravel svg laravel-4 gd