Loading image onto a website from url instead of database - html

Could loading images from a url create potential security or performance issues that would not be a factor if you had loaded the image from a database?

No, that's not true .And one important thing image will load faster if you load it from url instead of database.

Related

Upload images on mysql

I am working on a social networking site and i would like some help. I want the users of the site to upload images on mysql database. (I am using jsp pages). Any ideas?
You can, although it's generally a bad idea.
It's better to store the images somewhere on your server and store the image's path in the database instead, where you can save it along with other data (e.g. information regarding the uploading user).
If you insist, store it using this type:
http://dev.mysql.com/doc/refman/5.0/en/blob.html
Here's an example.

Is it bad to store images as Data URIs in a database BLOB?

I'm creating a mobile app that views articles. These articles are just simple html with a couple of images each. I am currently storing everything in a database. Later, I will need to save the articles locally to the device in an easy format. For this reason, I have opted to store the Base64 images within the database, using a Data URI Scheme (look here for info http://en.wikipedia.org/wiki/Data_URI_scheme).
My question is: is it okay to store this much data in one database entry? I have a table that is ONLY for these large records, with article meta data tables that point to these. Would it be better if I used TEXT fields, rather than BLOBs?
If it helps, I am using MySQL with the InnoDB engine.
Avoiding using the db to store images is a good practice, keeping the images in the db not only slows down your db performance it also increases it size and backups, if you are using cloud service then there is also the cost issue.
Use S3 or Azure for this purpose and have only the url of the images in your db.Files may be uploaded directly to to the storage service reducing load on your db server. The only thing left to do is for your mobile application to connect both this services(db and the Images service),i found this web tool to manage my mobile app db because it connect to my Images cloud service which is Azure but i think they also support Amazon S3.
Another option would be to store images in something like:
Amazon S3
and then just have a field in your database that stored the url for each image.
As long as you dont have a DB as big as facebook or similar it should be fine.
It is best to store just the path to the image and the image themselves in a folder.
hope that helps
You could also look into Azure Blob Storage. I've been using it and it's working very well.

Better store images on server or image strings on database?

i'm developing an android app where the user can take a photo. The app will have to upload it. I'm new of servers/databases. What's better? Store the image file "image.jpg" on the server or store the image string, encoded with base64, in MySQL db?
Are there other strategies?
CONSIDER THAT i will have to reload the image to visualize it on the phone.
i think better way is to store the images in a folder on the server and store their link in database..
Reasons
1) Normally time required to perform file operations is less than time required to perform database operations.
2) Updating the image is easy because its stored in file system which prevents the update operation on database which takes more time.
I think it is not a good idea to store image string in database instead of just its path (image name). Store your image on server and its name or path in database. Because retrieving image string from db and creating image for it each time you need that image is expensive. So better store its name only in server.

Load time pondering - Images and Domains

So I'm in the process of adding links to images on my web site, and I've come across something interesting.
All the images I'm linking to are housed on another domain, but this domain happens to be located on the same server as the site I'm working on. Now normally I would download images from the other domain and place them in my website's directory structure, so as to avoid having to connect to another server and thus save on load time when grabbing the images on page load. But in this case, with the two file structures being located on the same server, I wonder if the time to download the images on page load would be virtually the same with absolute linking to the 'sibling' domain versus storing the images on my site itself.
Does anybody know if this is the case?? Thanks :)
I think here's where your thinking goes astray:
Now normally I would download images from the other domain and place
them in my website's directory structure, so as to avoid having to
connect to another server and thus save on load time when grabbing the
images on page load.
This is not true. It doesn't save load time to have all the images on the same server. The browser is the client making the request for the image. The server to which the browser makes the request doesn't matter.

Saving pictures in the a MySQL DB vs saving it as file

I know this question was asked in various ways here, but none of the answer is conclusive.
I have a system which among other things updates a website gallery.
I can both "upload" the file to the website (and save a copy at the system - needed) or just save it in the DB and save the space (and another upload). If I go with the files I would need to "notify" the webpage of every change (picture delete, add or change) instead of just making the change in the DB.
So:
If we are talking about a standard website with a picture gallery, is it best to save the pictures as pictures or in the DB?
If the webpage is very visited or very large, does it makes any difference?
Is the difference that significant? Or just go with the convenient way?
Although I presented my case I would like also to have a "more in general" answer, what is the "good" approach when talking about saving files.
Thanks in advance for clarifying it,
Michel.
Only put structured data in a DB. Images are files and should be kept on a files system. The performance of the DB will degrade more and more as the number of pictures / users grows. Instead create an image object which you can use to track the image location and meta data.
I have had the same problem with you in a previous project of mine.
I decided to go with only storing the path of the image in my database (which is just a string) and save the image in the file system, not in the DB.
This is the best practice in many ways.
It keeps your DB small, getting a large amount of rows is faster and DB back ups are significantly smaller.
Just put the images in a file and save the path in the DB so you can retrieve it later.