我开始使用Laravel 5.3并且我的开发环境在本地工作,但现在我需要将应用程序上传到生产服务器.我无法在同一个应用程序上配置两个环境.
我在两者(本地和生产)上使用Apache Web服务器.
任何指南/文档都很受欢迎!
有没有办法在不事先将图像写入存储的情况下调整图像大小?我正在使用一个 pdf 库,图像需要它的字节。
我所做的是使用 http.get 获取图像,然后获取将其放入 pdf 中的字节。问题是我需要先调整图像大小,然后再将其放入 pdf 中。
我唯一拥有的是图像的 url 或 uint8list
Response response = await http.get(imageUrl);
Uint8List imgBytes = response.bodyBytes;
Run Code Online (Sandbox Code Playgroud)
之后:
Image(
PdfImage.file(pdf.document,
bytes: imageBytes)
),
Run Code Online (Sandbox Code Playgroud)
我使用的 Pdf 库: https: //pub.dev/packages/pdf
我只需要获得单项,所以我在模板中使用了ngIf而不是ngFor.
模板:
<div *ngIf="item | async">
Id {{ item.id }}
Number {{ item.number }}
</div>
Run Code Online (Sandbox Code Playgroud)
服务:
get(id: number): Observable<Response> {
return this.http
.get(`myApi/id`)
.map(response => response.json());
}
Run Code Online (Sandbox Code Playgroud)
零件:
export class DetailItemPage {
private item: Observable<Object>;
ngOnInit(){
this.getItem(6994);
}
getItem(id){
this.itemProvider.get(id).subscribe(
res => {
this.item = res;
console.log(this.item);
});
}
}
Run Code Online (Sandbox Code Playgroud)
在控制台日志中,我正确地看到了对象.
有了这个例子,我得到错误:
InvalidPipeArgument: '[object Object]' for pipe 'AsyncPipe'
Run Code Online (Sandbox Code Playgroud)
但是,如果我删除异步管道,WORKS.我可以看到项目ID和号码.为什么?我做错了什么?
PS:我使用了Angular 4.1.3
laravel ×2
laravel-5.3 ×2
php ×2
angular ×1
asynchronous ×1
dart ×1
flutter ×1
observable ×1
pdf ×1
production ×1
storage ×1