Can AQuery load image from a HTML page? - android

I just tested AQuery's image loading based on this tutorial. It works well, when I use on an URL like example.com/xy.jpg. But what if I want to load an image that is displayed by a page (for example a php page)?
If my url is like this: example.com/showimage.php, I get a message of this: SkImageDecoder::Factory returned null.
Does AQuery support deferred image loading?

Yes it can if the PHP page redirects to a valid image.

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.

Glide is not working in my project

I am developing an application in which i am using Glide Library to load image from server. But Unfortunately this is not working and i am completely unaware about this and trying to solve this issue since last two days.
this is my code.
Glide.with(this).load(response.getBank_cash_deposit().getData().getAttributes().getAttachment()).into(mSelectedImage);
Try Log your image response. you're getting correct image URL or not.
If the image URL is correct then check whether there is space in your image URL or not.
If the space is exists then replace space in your URL String with %20 with the help of string.replace() function.
String image=response.getBank_cash_deposit().getData().getAttributes().getAttachment();
Log.d("Image",image);
if space exists
then
image.replace(" ","%20");
Also check image url on web.

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

Android Query - Async Image load with redirect

Having trouble downloading an image when using the Android Query (aQuery) library to download image that has redirect:
Using url https://api.twitter.com/1/users/profile_image?screen_name=scottyab&size=bigger
in web browser redirects to
https://si0.twimg.com/profile_images/2467461312/5rab7gapdrnd84b6nflx_bigger.jpeg
Here's the activity code for doing the async image call:
aq.id(R.id.twitter_image)
.progress(R.id.twitter_image_progress)
.image(getTwitterProfileUrl(twitterName),
true, true, 0, R.drawable.no_profile_placeholder,
new MyBitmapCallback());
Getting an internal AQuery error 101 network error. This there an option to enable AQuery redirect? The URL returned in the call back is the original url not the redirected URL. Specifically finding this an issue on Android 2.1
Android-Query doesn't appear to handle redirects currently, and it looks like it would require a code change to support them.
I took a look at the AQuery source code, and I think this is the code to do the request: https://code.google.com/p/android-query/source/browse/trunk/src/com/androidquery/callback/AbstractAjaxCallback.java#1483
Here is how it could be implemented to follow redirects:
Httpclient redirect handler
It would have to handle codes >= 300 and < 400 to handle redirects.

Avoid pictures from loading and capturing the URL in WebView Android

How to avoid all the pictures from loading, in WebView?
Also I need to get the URL of those pictures.
Thanks in advance!
If you are developing for API level 11 or later, you can use the WebViewClient.shouldInterceptRequest to handle the request for loading an image. The second parameter of the method is the URL of the resource.
You would have to return the WebResourceResponse object, possibly a placeholder/error image if you do not want the original image to be loaded.

Categories

Resources