Storing images for multiple web sites - asp.net-mvc

I've got two web sites (written in c#) which are pretty common:
One is an admin site (cms) where you add images into content as needed, through editor pages.
Second is the site where the content with images is shown.
Images should be stored outside these two sites but where and how?

You could store them on a third site for static content, then both sites would link to that content. That can give you some benefits if you really need scalability as well.
However, you may also store it in a shared database, or just a shared file share, that you have encapsulated logic that each sites that needs access to them uses.
If you dont want to both with the storage there are many "cloud" storage servers that will host all your images for you. (like Amazon S3, Smugmug, flickr).
But then you will have to build the logic in your app to upload the submitted images to your 3rd party storage provider.

You can store images inside a database. There are plenty of tutorials on how to store images in a database (images in mysql php, images in mysql asp.net, etc). The language isn't important, any of the tutorials can help show how to store images inside the database itself. Then it's just a matter of language specific calling the image out to display it.

Have you considered storing your images on something like Amazon S3? You could then access the images from both sites. Somehow, though, you'll need to store the URLs to the images and make them available for both sites.
If both sites run off of the same database, this is fairly easy, however, if they are separate databases, then I would suggest creating some sort of API on the creation site so that the content site can easily discover which images are available to be shown.

Related

Using cloud storage for images in a Ruby on Rails app

I have been struggling with an efficient way to store and manage the pictures I need in a Ruby on Rails app I am building. I will use a real estate app as an example:
In my real estate app I have a House model and a House controller. On the House #show page I want to list information on the house as well as display pictures for that particular house. Some of the houses have five pictures, others have one. What is the best way to store these pictures and display the ones that pertain to that particular house?
Obviously I do not want to store them with the app, that would be way too bulky. I have tried using Amazon S3 buckets and the Amazon SDK but was unable to get it up and running. Amazon's documentation is all over the place. I currently have pictures stored in a Google Cloud Storage Bucket. They have a public link so an individual image is easy to display. The problem lies in the fact that each house might have a different number of pictures associated with it.
Google's documentation is difficult to navigate, especially when it comes to Ruby. If there were an easy way to access my bucket and filter the files stored there, this would be a breeze. Any ideas? Does anyone know how to do this in Ruby? This type of photo storage is very common and I am surprised at the difficulty I've had in getting it set up. Thanks for your help.
Amazon S3 is one of the best options out there, but it can be a little confusing. Try the paperclip gem for adding file associations to your models.
It gives you multiple options for how to store files and makes it easy.

mobile project with openshift

I would like to develop a mobile app which publish pictures online inside a mongodb on openshift.com.
At the same time I would like to host website where some customers can see a "wall" with all the publications.
My question is: Openshift.com is a good choice when you need to store datas (pictures, text) from smartphones and in the same time to host a website?
p.s. the pictures will be stored directly in the mongodb, is it a good way to do?
Thank you in advance
Yes, you would be best off writing a simple API that your mobile application will connect to (in your language of choice) to get the data into mongo. I personally would either store the images on the filesystem in your app-root/data directory, or store them on Amazon S3.

Storing images not as part of app

I am building my new site and have a small group of images I want to display on the site.
They are not images to do with styling so it feels wrong to store them within the app/assets directory
I don't wish to put them on my Flickr account which builds by apps gallery as they are not that type of image.
I currently have them stored on an Amazon S3 bucket and link to them from there.
is there a better way. What way would you guys choose?
If I am already using the best way, is it worth linking to them using the standard url Amazon provides me with or should I direct one of my URL's to that point?
Your choice for Amazon S3 seems fine to me, and no, you should not change the standard URL's Amazon provides you with. Advantage is that your own web server is not bothered by the image URL's anymore!
I have a similar website storing "dynamic" pictures, and I keep them on cloudinary, which is a similar site. Your source directory should not in general store these "dynamic" pictures. They only consume disk space, and sites like Amazon S3 and Cloudinary are made just for that!

Is it OK to use Twitter and Facebook profile images without storing them in my server?

Currently I'm using Facebook connect and Twitter oauth to authenticate users. and I'm using their profile image urls directly instead of storing them on my server. I guess it's better to save the thumbnails and think eventually may need to do that, but for now am trying to save as much money as possible. (I'm currently using Heroku to host my project and can't store files unless I use S3 or the likes, which would cost me money)
I'm wondering if this is OK, and if most web apps start out this way. Or if I need to store the images.
Also, now I want to let users set up accounts without Twitter or Facebook. In this case, is there a way to use a "third party thumbnail hosting site" (I don't even know if such a thing exists) for free instead of using S3? It can even be a short term hack, since I plan to eventually implement image storage if this gets traction.
I think not storing them is the best way. If someone changes their picture, you always show the latest this way, if you stored them, well then you would have an old version of their picture after time which could make your app look stale.
As for where to store alternatives, I would really consider s3. It is very cheap storage, and thumbnails won't need a lot of space. It would only get expensive if you had a LOT of users, and if you have a LOT of users, you should be able to afford the storage.
Also, have you looked at Gravatar? A lot of people have those linked to their email addresses, it might be another good way to get their picture. http://en.gravatar.com/site/implement/

Selectively uploading files to a website

My office uses a piece of software that generates XML based reports. These reports also reference images files which are created during the generation of a report.
I'm trying to develop an ASP.NET MVC web app that will allow users to share and collaborate on these reports. The site will read the XML data into a database, as well as store the images files to be viewed on the site.
However, the problem I'm having now is the reporting software generates many more images then are actually needed by my site. After reading through the XML report data my site will typically find that it really only needs a few images uploaded out of all images that were exported by the software.
I don't want to waste bandwidth or time by having the user upload every single image to the site, as most would end up just being deleted after the site reads through the XML file.
Is there any other way to allow a web-app to selectively upload files from a users computer? Ultimately I would like for the site to be able to read in the XML report file, determine what image files it needs, and then proceed to upload only those images.
Could this be accomplished through java script in the page? What about a silver light?
I know I could develop a stand alone executable that would handle parsing the XML and uploading the images. But I'm trying to avoid requiring the user to install anything to use this site.
unfortunately for security reason it's not very easy to have a web app access the local drive and copy files to the server. However, here are some suggestions:
Create an activeX that has full access to the users computer. (IE Only, has to be installed) basic activex, old example to upload files.
Create an applet, similar to ActiveX (cross browser). Example
Completely different idea, but maybe a bit simpler, you could have the user upload the xml, the server would determine which images it needs and display it to the user. The user could then do a multiple file upload of just the files you listed.
Best of luck.

Resources