从Firebase加载图像的速度很慢 [英] Loading images from firebase is slow

查看:110
本文介绍了从Firebase加载图像的速度很慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当我登录我的应用程序时.图像加载缓慢.通常需要花费很多时间来加载. 我正在使用Glide作为我的应用程序中图像加载的库.

Whenever I sign in to my app. The image gets loaded slowly. It usually takes lot of time to load. I'm using Glide as a library for the Image loading in my app.

 Glide.with(photoImageView.getContext())
          .load(message.getPhotoUrl())
          .into(photoImageView);

上面的代码用于将图像加载到我的UI上的ImageView上,因为您可以看到完整的图像需要花费很多时间来加载.

This above code is used for loading the image to the ImageView on my UI as you can see the full image takes lot of time to load.

为了从Firebase更快加载图像可以做什么 存储空间?

What could be done in order to load the images faster from Firebase storage ?

推荐答案

借助克里希语(在堆栈溢出).他建议我更改此密码

With the help of Krish (on StackOverflow). He suggested me to change this code

Glide.with(photoImageView.getContext())
  .load(message.getPhotoUrl())
  .into(photoImageView);

此代码.可以使用下面的代码完美地工作.

to this code. It is working flawlessly with the below code.

Glide.with(getContext())
  .load(message.getPhotoUrl())
  .asBitmap()
  .centerCrop()
  .into(new SimpleTarget < Bitmap > () {
    @Override
    public void onResourceReady(Bitmap resource, GlideAnimation << ? super Bitmap > glideAnimation) {
      photoImageView.setImageBitmap(resource);
    }
  });

这篇关于从Firebase加载图像的速度很慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆