laravel 干预图像 - 以 base64 编码格式保存到变量
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/33585592/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Intervention Image - save to variable in base64 encoded format
提问by Limon Monte
I'm using Laravel with image manipulating package Intervention Image.
我将 Laravel 与图像处理包Intervention Image 一起使用。
I want to save cropped image to variable and then to DB but can't find in documentation how to export result as string. Here's my code:
我想将裁剪后的图像保存到变量,然后保存到数据库,但在文档中找不到如何将结果导出为字符串。这是我的代码:
$img = Image::make($uploadedImage);
$img->crop(160, 210);
$imageEncoded = // ?
There's save()
, but it only saves to file.
有save()
,但它只保存到文件。
How can I export modified Intervention Image to string variable? (data:image/jpeg;base64,…
)
如何将修改后的干预图像导出到字符串变量?( data:image/jpeg;base64,…
)