I am using https://components.xamarin.com/view/KenBurnsView
I have several image URL-s by which I want to show them via KenBurnsView
after setting src of KenBurnsView to the first imageURL, at the TransitionEnd I want to replace src with new image URL and restart animation, but I want the image to be preloaded to make everything smooth.
I would preload next image at the TransitionStart event so at the end image could be loaded, but I dont know how to do it.
Image caching is what I mean maybe but I dont know how to cache it very first time
For image caching you can do it yourself, saving the image in the FileSystem when downloaded from internet and next time you need to load the image you check if it's already local and if it's not you just hit the web and save it. There's of course a little more to do like deleting the images in file system after certain period but just wanted to give you the main idea.
For my projects I use this library FFImageLoading. It's well maintained and its use is so simple.
ImageService.Instance.LoadUrl(urlToImage).Into(_imageView);
When the image is loaded from internet the image is cached on disk (by default 30 days but there is an optional TimeSpan so you can choose yours).
Android documentation.
Related
I would like to know a most efficient way to load external images to my website.
For example:
My website's url is "www.mydomain.com". The external image is http://www.myimagedomain.com/image.jpg.
The most common way is to write a simple html image-tag like
<img src="http://www.myimagedomain.com/image.jpg" />.
The problem is, if the requested image is very large (8000x6000 pixel) but I want to show this picture as a thumbnail/preview like 200x200 pixel, e.g on mobile devices.
Based on this information I wrote a little ashx (c#) handler that downloads the requested image and resizes it to a given weight/height parameters, like this:
<img src="http://www.mydomain.com/img.ashx?imageUrl=http://www.myimagedomain.com/image.jpg&w=200&h=200" />
Now there is another problem, because the httphandler always downloads the requested image, on-the-fly.
My new approach is to generate a based64 string from the resized image and save this in a database once?!
Would you recommend this or is there another way to eliminated the download problem?
Maybe someone know how google-image-search prevents this problem?
I don't want to save the external images on my own server...
I would suggest to use image resizer library, it solves much of what you need in efficient way - caching included:
http://www.nuget.org/packages/ImageResizer/
I think google caches image thumbnails on its servers for search.
So I'm working on a project that requires being able to bring up google images pertaining to the selected item.
Right now I'm using the Google Custom Search API to make an image search and getting the results back as a json. I then parse out the first FIVE image paths provided and add these as images to a wrap panel.
Quick snippet of what this looks like
BitmapImage bmi = new BitmapImage(new Uri(url, UriKind.Absolute));
image.Source = bmi;
The problem is that this takes on average 20-40 seconds. While the google search takes less than 1.
I initially assumed this is because google is just loading thumbnails while I'm downloading the complete image, but I checked out all the sizes and none of them are larger than 30kb, and all download instantaneously through a web browser.
So I think I'm just approaching this the wrong way.
What would be the right way to load in previews and then allow the user to select one to actually save locally.
Regards.
John W.
I have a admin panel where i am uploading some video and settings some of its parameters manually to save it in database fields, like FileName, FileSize in Mb and Video duration.Now the requirement changed and it became something this, immediately after selecting a video file (either of them avi, mpeg, mp4, mpg, dat or vob etc), in a file upload control, the properties of the video file will get immediately set to its corresponding label or textbox.
I have tried a lot but unable to find any event related to the same. Also one more issue i faced while getting the duration of the video. I have tried DirectShow and FfMpeg but of no use. So basically i am stucked with the problems where I need your help. I am only able to get the file name immediately in javascript. So i need your suggestions.
How To retrieve the duration of video,immediately after video selection in fileupload control either in javascript or c# (any open source managed lib will b heartily welcome).
What you can do is create a client app to upload, that can collect the information you want from user's machine.
Another approach is to upload to the server, process the information you need to and then send it back to browser, but that may take a while and it won't be instant like after selection.
For a lib to work with video, haven't used any, but you can try VLC.NET and this in C#, for javascript i think it will be hard to find if there is any.
This one will be interesting...
I have seen many asp.net thumbnail generation tutorials / sample code, but no one has considered the problem of concurrency access when generating thumbnail image dynamically, when one or more user access the same page when the thumbnail needs to be generated.
A simple case, i have a site with property images (houses etc.), images are stored in a folder, the thumbnails are generated (for gallery) when someone first time accesses particular offer, then a handler makes the thumbnails from original larger images, the handler generate each thumbnail only once and then use the generated image in further requests.
What happens if two users access this page in the same time, the handler could run twice on the same file or more, there could be concurrency problem, file opening errors and so on (file needs to be opened for thumbnail generation).
Normally one user gets the thumbnail and other get a blank box without image till they refresh the page (since the first user triggered the thumbnail creation)
So the question is, how to avoid this situations ?
Normally if you are only opening the original image file for reading in order to generate the thumbnail there is no problem accesing it concurrently. Multiple users can open the same file for reading at the same time. Problems arise if you start writing at the same time.
I have an image gallery that is created using a repeater control. The repeater gets bound inside my code behind file to a table that contains various image paths.
The images in my repeater are populated like this
<img src='<%# Eval("PicturePath")' %>' height='200px' width='150px'/>
(or something along those lines, I don't recall the exact syntax)
The problem is sometimes the images themselves are massive so the load times are a little ridiculous. And populating a 150x200px image definitely should not require a 3MB file.
Is there a way I can not only change the image dimensions, but shrink the file size down as well?
Thanks!
I would recommend creating a handler that can resize images for you on the fly and encode them in whatever format you like.. kind of like a thumbnail generator. This will cost CPU on the server but you can cache images and severely reduce bandwidth costs ETC. Let me see if I can find the link to a good article I read on something similar.
You can look at this article it isn't the one I had read but it has some info about how you can go about implementing this.
You're looking for the GetThumbnailImage method of the Image class. You will either want to generate the thumbnail images ahead of time or create the image the first time it is accessed and save it to disk for later use (so first access would be slow but subsequent requests would be quick).
You could try either of these 2 projects on CodePlex.com, both offer dynamic image generation with caching.
Dynamic Image Process
ASP.NET Image Generation
The later is straight from Microsoft.