PhotoView icon indicating copy to clipboard operation
PhotoView copied to clipboard

Show images from URL

Open duttabhishek0 opened this issue 3 years ago • 2 comments

🚀 Feature Requests

Fetch Image from an URL present in the form of String

Contextualize the feature

Images are stored as URLs in Cloud Databases. Need of a method to fetch image from that URL and then display.

Describe the feature

Currently to set an Image, the following method is invoked:

imageView.setImageResource(R.drawable.image_id)

The method only accepts a parameter of type resource id. But if a string is provided instead, it would give compilation errors. Please add a feature to fetch image from cloud database, given in form of URL. A URL is of type String.

duttabhishek0 avatar Oct 20 '21 05:10 duttabhishek0

you can use Picasso or Glide to achieve this.

tarekmabdallah91 avatar Nov 17 '21 11:11 tarekmabdallah91

add in your main program :
... get File by TCPIP download from your database Bitmap myBitmap = BitmapFactory.decodeFile(file.getAbsolutePath()); // file : File to your image mPhotoView.setImageBitmap(myBitmap);

add in PhotoView.java :
@Override public void setImageBitmap(Bitmap bm) { super.setImageBitmap(bm); if (attacher != null) { attacher.update(); } }

francoisnicolas avatar Oct 23 '22 12:10 francoisnicolas