How to display .cms image file in android activity - android

I am trying to display an image in an activity after parsing it's URL in JSON format from the web. The image string thus obtained has a cms file extention. I know that Volley's image loader toolbox can be used to display jpg images but with this extention it is unable to inflate the view. What should i do?

Try replacing .cms with .jpeg in the url itsel. It worked for me.

Related

Store images from url in cache and use them as thumbnail or placeholder like whatsapp.

I am developing story feature app like instagram or whatsapp but I got stuck somewhere. I am getting image thumbnail from server as URL but when I try to use it . It take some time to load that image.So I want to Load add thumbnail images from url in previous activity and then set that thumbnail from cache.How I can store url images in cache Hashmap or arraylist to use them in next activity.Please help.I am in trouble right now.
You can use Glide for catching the image from URL.

android Picasso load image from storage

i am using Picasso for load image from web and local storage
for load image from web
Picasso.with(context).load("http://i.imgur.com/DvpvklR.png").into(imageView);
and for load image from storage i add file:// before path for load image
Picasso.with(context).load("file:///android_asset/DvpvklR.png").into(imageView2);
but when file path have utf-8 charchter with file name its not load the image like file:///android_asset/۲۰۱٧.png
any idea how to solve it every time i want to use picaso its must string path not Uri or File because its saved in sqlite as string
Try this code:
String url = "file:///android_asset/۲۰۱٧.png";
URLEncoder.encode(url, "UTF-8");
Picasso.with(context).load(url).into(imageView2);
try doing
URIUtil.encodeQuery(url)
see the issue at:
https://github.com/square/picasso/issues/652

How to download a file and open it in imageView?

The URL do not ends in .png or .jpg or any image format
URL is like this:https://www.abcdef.com/funlearn/downloadFile?id=27
and it is an image.If I paste the URL in any browser it starts downloading the file with .jpg extension as food.jpg.
Picasso.with(getApplicationContext())
.load("http://i.imgur.com/DvpvklR.png")//working
// .load("https://www.abcdef.com/funlearn/downloadFile?id=27")//Not working
.into(image);
getting this error :D/skia: --- SkImageDecoder::Factory returned null
Reason is whatever you put inside a" load" should be a file. End thing should be a file. Picasso try to load that file for you. You can use it to load a file in your device sdcard etc. Specifically file should be a image or video. Hope it helps

Using webview to load image from rest server in Android

I have a rest server hosted in Amazon written in Delphi with a method returning a jpg Stream image.
I need download the image and show in webview.
The method Rest Server method is something as:
//delphi code
function TSrvServerMetodos.ImagePac(pront:integer): TStream;
var blob:TStream;
begin
...
Result := CreateBlobStream(fieldbyname('PHOTO'),bmRead);
end;
where the Result is a jpeg Stream with a image.
To access the remote rest method I am trying to use the next:
String url = Common.getServerUrl() +"/"+ "\"ImagePac\"";
String URL=url+"/"+"23";
webView.loadUrl(URL);
But no Image is showing in webview.
My image is comming from a rest server and no a website. I have no way to call something as webview.loadUrl("http://www.myserver.com/myimage.jpg");
Is possible load that image with webview?
Regards, Luiz
Yes, It is. To solve the problem I had to save the image to sdcard and create a html string to load the image with webview.
For the new offspring with the same trouble. Just encode image in base64 and place it in src attribute of img tag

JSOUP to display images in Image view using the URL

How can i use JSOUP to display images in Image view using the URL. Any sample code is available for that. I searched but i couldn't find out.
Please help me with any link.
Thanks.
fir make the connection with provided link then you can get the image with
imagesRec = document.select("img[src~=(?i)\\.(png|jpe?g|gif)]");
then
String imgSrcUrl = img.attr("abs:src"); // imagePath
the you will use the Picasso lib for displaying the url as image in imageView
Picasso.with(MainActivity.this).load(imgSrcUrl).into(logo);
and thats it
you would have to parse the url of the image from the tag and then put into a string or similar. this string you can then use to load your image into an imageView.

Categories

Resources