Cache images wp8.1 - visual-studio-2013

I have array of URIthat contains likns to images from internet. I want have access to this ones without always connection to the internet. I see such scenario: in first start of my app i download all images to the appdata folder, and make array of internal URI. Than I save this array in localsettings.
But maybe there is way to cache images with standart librarys of C# and use original array of URI to get access to images from offline?

There's a good open source library that can help you with that.
Q42.WinRT
It has something called ImageExtensions.CacheUri which means that it automatically caches images based on Uri.
<Image q42controls:ImageExtensions.CacheUri="uri of your image" />
And don't forget the q42controls namespace.
xmlns:q42controls="clr-namespace:Q42.WinRT.Controls;assembly=Q42.WinRT.Phone"

Related

React-Native / Realm : how to store an image in the database?

My app has to regularly download some content and keep it available offline. I use Realm for that and so far the experience has been great. But I really don't know what to do when it comes to images. I could store a ref to the paths but I'd really prefer Realm's direct storage. Is there a not-too-complex way to achieve that ?
N.B In fact I'd be looking for a snippet like the one above, which would perfectly fill my needs... but this is for IOS, not react-native -> How to put an image in a Realm database?
You can store the base64 string version of the image in Realm. It works great. I am doing that.
I can't seem to find a built it React Native api for dealing with images already stored in memory, and without this it may not make sense to store images in Realm.
It does look like React Native can open images from the filesystem though with paths specified at runtime - https://facebook.github.io/react-native/docs/images.html#network-images
If you take this route you can download/save the image to disk, and simply save the path to the image in Realm.

Meteor JS image upload and display

I'm trying to build a E-commerce site with a admin page where the administrator can upload images of certain products.
I'd like Meteor to upload those images to a folder and then display those images in the product page of that product.
I know that normally the image files that the client will be using should be inside the 'public' folder, but I'd like to know more about what other options I might have.
Also, if I upload a new file to the 'public' folder or if I delete a file in the 'public' folder, the website refreshes itself...and this is good and bad at the same time depending on what effect you are after....
Here are my questions:
What if I create a 'uploads' folder in the server and upload the images to that folder. Would it be possible to display the images inside the 'uploads' folder in the client browser??? How??
Is there a way to use the browser to access the contents of the 'public' folder???
Is there a way to stop the 'reactivity' of the site if changes happen in the 'uploads' folder created?
Is uploading the images to the 'public' folder the best solution available to this problem?
Thank you very much for the help
When dealing with what will likely be a large number of images I like to offload not only the storage but also the processing to a third party.
My go-to app in this situation would be Cloudinary. Here's why:
Storage - I can store the original images outside of my application. A huge benefit to keep images in sync from dev to prod.
CDN - I get the extra benefits of images being quickly loaded from the Cloudinary CDN.
Off-load Processing - All of the processing of images is handled by Cloudinary which doesn't slow down my app as a whole.
Image Manipulation - I can make calls to the original image, calls to just get a thumbnail, and calls to change manipulate, ie :effect => grayscale. So if a 1000x1000px image was uploaded, I can request a 50x50px from Cloudinary that will return the image cropped to that exact size rather than using CSS to shrink a huge image.
Flexibility - I can change the size of images and return that exact size to the app without having to re-upload images. For example, if my product page pulled in thumbs at 40px, I could easily make a call to grab the same image at 50px.
Hope this helps.
http://cloudinary.com/
You can do all of this using the meteor package collectionFS. The package is well documented and you have a variety of options that you can uses for storing the uploaded files. CollectionFS also gives the ability for image manipulation on the upload, such as creating a resized thumbnail.
I realized this question is a bit old.
I had the same problem, one of the solution that works for me is using meteor-upload https://github.com/tomitrescak/meteor-tomi-upload-jquery
Definitely don't store stuff in the public directory - it will slow down starting up the app, and hot code refreshes on image upload could easily cause it to crash once there are a decent number of images in there.
Any of the above solutions with storing images elsewhere would work. One other option is using the peerlibrary:aws-sdk package to upload stuff to S3, which is what I use for several apps and have found to be very clean.
Storing the image as a base64 string in MongoDB is also a method. Useful for posting to APIs and save the worry of having to handle other 3rd Parties.

How Should I store images - Codeigniter

I'm contemplating on how to store images in my new site.
Should I save the images directly to the database
OR
should I upload them to my server, while storing the path in my database?
Also, should it be the second choice, how does one retrieve the path of a file he uploaded previously?
You should definitely go with the second option as you can take advantage of the user's browser caching these images after the initial request. It also means your database wont be hit constantly for large files which is always a bad thing.
In CodeIgniter there are various parameters you can use to get the name / full file path to store in the database.
See http://ellislab.com/codeigniter%20/user-guide/libraries/file_uploading.html
Also take a look at this great SO question Storing Images in DB - Yea or Nay?
I tried CI's own libraries , its good but not best, Image moo solved all my problems, uploading, resize, crop etc..
http://www.matmoo.com/digital-dribble/codeigniter/image_moo/

Which configuration for "dynamic" images in GWT/GAE (cache, public folder...)?

First, I do not know what I should understand when we talk about "dynamic images"... but in my website (talk about movies - www.mananaseguro.com) I have to display the poster of each movie. So I think these images are considered dynamic images.
I do not know:
If these images should be in the cache, and if yes what expiration date (GAE)?
If these images should be in the public folder (GWT)?
How to correctly refer to these images, I use setUrl("./MananaSeguro/posters/p1.gif") (GWT)?
If my APPLICATION_SPRITE (that have all UI images) be in the cache (GAE)?
I do not like to have all these images in ./client/resources/ directory. Is it possible to have them in the WAR directory to be more conformtable (if yes, how to configure it)?
After that, I will use OBJECTIFY for my database, but the same kind of question occurs :
Do you know in wich directory would I need to store these images (I will need to refer to their path inside the database)?
I do not know GAE, but do you know if there is an interesting feature to store these images (Blobstore)?
Not sure if you're talking about Google memcache service or browser cache. The images should be stored in the browser cache (the required headers will be set by the image service when the images are served). The images should not be stored in the memcache service, that's for storing data that is fetched regularly and/or is expensive to fetch or calculate.
The public (I assume you mean "war"?) folder is for static content, not dynamic. You'd need to re-deploy your application each time a movie was added if you stored movie images here.
The Images service generates serving URLs from blobstore keys. These are the URLs you pass to setUrl on the client.
The application sprite image should go in the public folder as it's static.
This page describes how to specify which files/paths should be served statically from the WAR
The dynamic images will be stored in the blobstore, so you just need to keep the blobstore key to retrieve them
Yes the blobstore is what you're after. With the Images API doing a lot of the "heavy lifting" for you.

Challenges in loading images from CDN on multiple host name for e-Commerce site built on Nopcommerce

I am working on a ecommerce site built on the top of Nop Commerce 2.3. We want to use CDN for loading all static contents including its images, but not sure how to do this with NopCommerce.
Nopcommerce is set to save binary of images in db at the time of inserting product, and then it generates thumb or re-sized / optimized images at the run time as and when required and stored them in the content folder of the same application for retrieving on page during load time.
Now, suppose on some page, lets say, Home Page, we have 70 product images. I want to distribute it across four host name, so each host name will serve 17/18 images.
This is definitely to save some time in image loading.
Now the Question is:
How to do it in best way in NopCommerce?
The challenges are:
Changing in nop commerce code to load images from CDN instead of its application\content folder. This is not an issue and is fine to manage.
To implement this correctly we might need some mechanism that checks for image on CDN if it doesn't exist, then we might need to transfer the image from content folder to appropriate folder at CDN maybe ? (suggest), and if it doesn't exist in content folder, then need to generate suitable image first and then transfer it.
I'm concerned about this 2nd challenge, and wants to understand the best approach to do this. Moreover, how to do this... specifically check if image exists in CDN or not?
Not very much sure, how to do this? And is it okay or do you suggest something else?
If you use the OVH CDN, you simply point your dns to the CDN dns, add the static file's extensions to the CDN configuration, and let it work for you. All other extensions will pass through. No code to change.

Resources