How can I store my own images online?


#1

Question

How can I store my own images online so that I can link to their urls within my own websites?

Answer

There are sites that allow you to upload your images to the web. Once your image is uploaded, you can then use its web address as the value for the <img> element’s src attribute. More commonly, images and project assets are stored within a folder that also contains our HTML document. This allows developers to create paths to be used as src values that are relative to the HTML document. In other words, images and HTML files often exist on the same server or computer.


FAQ: Learn HTML Elements - Intro to HTML - Images
#2

What happens if the site where the image is hosted is down?


#3

This depends, if you host the static content (images are static content) on your own webserver, and the webserver goes down, the website can’t be accessed

if you have the static content hosted on a CDN (content deliviry network) and CDN goes down, your site will still be online, but the images won’t load. But CDN going down is very unlikely.


#4

Is the a way that I can reduce the size of my image?


#5

you could shrink the actual image with tools like photoshop or use css to manipulate width/height of image on a webpage


#6

hey can you give me a link of those site


#7

so my question is kind of complex. if you can use a file path from your personal computer to upload an image into your HTML, then doesn’t using that file path open up the possibility of someone looking into your computer? hacking? I’m assuming the reason we would want to use a third party website to upload our photos (and i’m sorry but the only one thats coming to mind is something like photobucket LOL XD) is to avoid such an attack on our personal file systems?


#8

is the .html file also on your computer? Then no, the website can only be accessed from your computer.

to share the website within the LAN, you would need a web server (which is just a piece of software you can install on your PC). Now your computer acts as server, but just within your local area network (the network your computer is connected to). Assuming this is your home network or a network that you trust, it should be fine.

to expose your website to the world wide web, you would need to take a next step, which is opening a port on your router. This is where security becomes a risk, now people do have access to your website, so if the webserver isn’t properly configured, you might get hacked

this is why its uncommon to host websites from your own computer, you really need to know what you are doing.

this is why services like amazon AWS and so exist, you can use those, then you don’t risk your own computer

if you really want to host your own website, use things like docker or VM to isolate the webserver (and files like images associated with the website) from the rest of your computer.


#9

https://tinypng.com/ can also compress using this software, if you want to retain size and quality