如何使用 glide 下载存储在 firebase 中的图像缩略图

How to download thumbnails of images stored in firebase using glide

我想从我的 firebase 存储中下载图像缩略图而不是整个图像。我正在使用 glide 加载图像,但我不知道如何加载图像缩略图,因为它会更快且内存效率更高。

您首先需要为图像创建缩略图,可能使用 Google Cloud Functions or Google App Engine. You can write a function that takes the original image, and runs it through ImageMagick 之类的东西,然后将其保存回 Firebase 存储中已知位置,例如 images/myImage_resized_<height>_<width>.png,然后您的客户端可以获取该缩略图.

或者,您可以使用 Imgix 或 Cloudinary 为存储在 Firebase 存储中的较小图像提供服务,方法是向这些服务提供我们的下载 URL 并从那里获取图像。如果您愿意做更多的工作,Google App Engine 免费提供 App Engine Images API,它可以做很多相同的事情。