从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 *). 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);
    }
  });