在将图像上传到Firebase之前调整其大小 [英] Resize an image before uploading it to firebase
问题描述
Firebase存储看起来非常酷并且易于使用,但是我想知道是否有一种方法可以在将图像上传到Firebase存储之前调整其大小,例如,在服务器中使用ImageMagick运行一个过程,然后使用Firebase SDK,但我注意到Firebase SDK Server没有存储功能.
Firebase storage looks very cool and easy to use, but I'm wondering if there's a way to resize an image before uploading it to Firebase Storage, e.g., run a proccess using ImageMagick in a server and then run the uploading process using Firebase SDK but I notice there aren't storage functions for Firebase SDK Server.
推荐答案
您还可以使用Firebase Storage + Google Cloud Functions 来上传图像,调整图像大小(使用ImageMagick或类似工具),然后将其写回Firebase存储.
You can also use Firebase Storage + Google Cloud Functions to upload an image, resize the image (using ImageMagick or similar), and write it back to Firebase Storage.
我有一个在此处一起使用这些示例(尽管我触发了
I have an example using these together here (though I trigger the Cloud Vision API, rather than an image resizer).
一个简短的说明:Firebase Storage没有Node.js客户端,相反,我们建议使用 GCloud-Node 库.
A quick side note: Firebase Storage doesn't have a Node.js client, instead we recommend using the GCloud-Node library.
这篇关于在将图像上传到Firebase之前调整其大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!