【发布时间】:2020-12-03 21:28:39
【问题描述】:
我正在尝试即时创建图像而不保存并发送到 Vue,但我无法显示。
在 Laravel 中
$img = Image::make('image-path')->resize(400, 400);
$img->text('name', 205, 138, function($font) {
$font->file('fonts/BostonHeavy.woff');
$font->size(42);
$font->color('#ffffff');
$font->align('center');
$font->valign('top');
});
return $img->response('jpg');
在 Vue 中
data () {
return {
image: null
}
},
methods: {
async fetchData (param) {
this.image = await this.$axios.$get(`image`)
}
}
在模板中
{{image}}
or
<img :src="image" />
总是显示损坏,但在 Postman 上测试它可以工作
【问题讨论】:
标签: laravel vue.js intervention