Aquery
Zoomable Web Image
In addition to ImageView, a WebView can be used to display an image along with Android build in zoom support for WebView. Image will be centered and fill the width or height of the webview depending on it's orientation.
I using,
String url1 = "file:///mnt/sdcard/image.jpg";
aq.id(R.id.webView1).progress(R.id.progress).webImage(url1);
I noticed that even if I cut off the connection and re-open that application, the image is still displayed. Is it cached? I looked into its sd card folder, nothing there. I'd like to utilize cached images instead of fetching it many times.
Also, I am both using Universal-Image-Loader and Android Query. I am just concern if they can both read cached images.
//Aquery
//returns the cached file by url, returns null if url is not cached
File file = aq.getCachedFile(url);
The url1 is being downloaded every time you call
aq.id(R.id.webView1).progress(R.id.progress).webImage(url1);
Your cached file is being returned to File file object but you arent making use of it in
Related
Here in my web-application under Images folder pdficon.png image is available I want to add this image using Image.getInstance() method but whaen I tring like this..
image = Image.getInstance("images/pdficon.png");
Here it showing Exception is
IOException :: C:\Users\Developpc\Downloads\wildfly-9.0.2.Final\bin\images\pdficon.png (The system cannot find the path specified)
So,what I need to do....
Signup for some free image hosting account and upload your image. After uploading your image you can get the URL of the image and put that URL for image.getInstanceMethod.
Image img = Image.getInstance(IMG_URL);
If you are using that image multiple times then create an string constant and use that.
I am using picasso plugin to load image.
Picasso.with(context).load(BackendConfig.media_url+folder+holder.media_name).resize(150, 150).into(holder.imageView);
It's working fine. But, I want to save that image in SD card by loading just once from URL.
How can I do that?
Picasso using LRU disk cache, no need to worry about loading it from URL once. If you need to load and save actual image as file, load it as bitmap resource instead, and use Bitmap.compress and FileOutputStream to save into file (PNG/JPEG/WEBP).
you can use this lightweight android library VINCI (wrot this for my self) its do every thing you want
caching - using LruCache
managing files/bitmaps (Saving files in internalStorage)
read this WIKI part for more visit my github repo .
Storage store = Vinci.base(context).process().load(uri).file();
Log.e("Created", Boolean.toString(store.isCreated()));
Log.e("FileObject", store.FileObject().toString());
Log.e("FullPath", store.getfullPath().getPath());
Log.e("LocalPath", store.LocalPath());
Log.e("Get Bitmap File", String.valueOf(store.getBitmap()));
Usually we loading picture is on FragmentPagerAdapter.getItem method.
such as:
Picasso.with(context)
.load(url)
.placeholder(R.drawable.user_placeholder)
.error(R.drawable.user_placeholder_error).into(imageView);
Images then don't show in ViewPager probably never download. But, I want to pre-download images. I've used Picasso.with().load(url).downloadOnly, but this causes multiple unnecessary same url downloading.
I want to pre-download images. If have same url image downloading, it merge downloading interface.
I'm using Glide.It's effective and power.Preload image only use preload() method.
I am trying to crop image.There is an ajax call made to the server end where cropping takes place and original file gets replaced with cropped image.
Now when i get back the control, i still see the old image even though cropped image exists at the same location.
Changes reflect only after page refresh which i don't want users to do it.Code for crop image is as follows
BufferedImage originalImgage = ImageIO.read(new File(filePath+"\\"+subFolder+"\\"+fileName));
ImageIO.write(originalImgage,extention,new File(filePath+"\\"+subFolder+"\\"+dateStamp+"_"+fileName));//save original image
BufferedImage SubImgage = originalImgage.getSubimage(xAxis,yAxis,width,height);
File outputfile = new File(filePath+"\\"+subFolder+"\\"+fileName);
ImageIO.write(SubImgage,extention,outputfile);
pls help
Thanks
Try to replace the image src parameter with the new path returned from ajax in ajax success call back.
Well after struggling a lot finally found the problem.The image is cached by the browser. So whenever u do any operations on image on the same file location , the latest copy is not download.Instead old image from cache is still referred.
Hence the solution was to make browser download latest copy.This was simple.
Append dummy parameter to file path forcing browser to download
rand = new Date().getTime();
var image_Path = filePath+"?crop="+rand
i am using - and new to - GWT and i made an Image Widget to view an image. This image is found on my file system i wrote.
String src = "file:///D:/myfolder/myfile.jpg";
Image image = new Image();
image.setUrl(src);
but image doesn't appear!
You should specify either the whole URL (http://www.example.com/img/myfile.jpg) or (better yet) just relative to the root: /img/myfile.jpg. And, of course, you have to place your images in your WAR directory.
That's the simple setup. If you have more images and want to optimize fetching them (many images -> many requests to the server), have a look at the ClientBundle.