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


#10

thanks…i will come back for more info when i understand the rest


#11

if i am hosting my own site using a vm or docker, do i need to always have my personal computer active, i mean always conected to the internet


#12

Yes, the computer needs to be active, as well as running the docker or VM. Which is why you usually go for a VPS (virtual personal server), which can be cheap, and it has fast internet. And they are responsible if downtime occurs

there are some good VPS, like digital ocean


#13

if i upload an image to my site file manager, how do i compose a url that will access the image


#14

so if my computer is inactive, my site wont be able to be accesed


#15

you will need to hard code the url into the page, but you can use relative or absolute file path, given the files are on the same device

inactive is a vague term, if you are not using your computer, you can still keep it running. Then its fine, but the moment you suspend, hibernate or shut the computer down, your site could no longer be reached


#16

ok, shut down or not connected is the word i wanted to use, but using docker to host my site, can i host sites for other people


#17

Yea, its possible. But why would you want to? I would advise against it

then just find free hosting services (or paid, and charge them the amount you have to pay)


#18

Ok then, i have done just that, but its just that free hosting sites are limited, limited storage etc, what hostingsite do you think is the best


#19

Make sense free hosting is limited.

The best hosting site depends on what you need to deploy. There are extensive articles which compare hosting, i would see if you can find those on google.

Writing those articles takes a lot of time, so they will be more extensive and better then an answer i can give you


#20

ok then, am just learning html and i have a site although its not very presentable to be called a site, but what code editor/creator would you recommend for me, want to put my learnings in to practice