DEV Community

Cover image for What Is an Image URL? A Simple Guide with Examples
photo2url
photo2url

Posted on Edited on

What Is an Image URL? A Simple Guide with Examples

I didn't pay much attention to image URLs until I started using Obsidian and working on my own websites.

I take a lot of screenshots when I work. They're useful for notes, but they also take up space. When I started syncing files through GitHub, I realized that keeping every image alongside my notes and website files wasn't always the most convenient way to do things.

I wanted a simple way to keep my images somewhere else and still use them whenever I needed them.

That's when I started paying attention to direct image URLs.

So, what is an image URL? In simple terms, it's a web address that points to an image. Once you understand how it works, you can use image URLs to share photos, embed screenshots in Markdown, or display images on your own website.

Let's look at a few examples.

What Is an Image URL?

An image URL is a web address that points to an image file online.

When you open a direct image URL in your browser, the browser requests the image from a server and displays it. Unlike a typical website URL, which usually leads to a webpage containing text, navigation, and other elements, a direct image URL points to the image itself.

For example, an image URL might look like this:

https://example.com/images/photo.jpg

This is an illustrative URL, not a real image link.

The important part is that the address points to an image resource that a browser can load.

Image URLs can point to files in formats such as JPG, PNG, WebP, and GIF. The exact format depends on how the image is stored and served.

Image URL Examples

Here are two examples to show the difference between an image URL and a regular webpage URL.

A regular webpage URL:

https://example.com/blog/my-photo

This address might open a page containing a photo, a title, some text, and other website elements.

A direct image URL:

https://example.com/images/my-photo.webp

This address represents a direct link to an image file.

The file extension can be a useful clue, but it isn't a guarantee. Some image services use URLs without a visible file extension, and some webpage URLs can look similar to image links.

The easiest way to check is to open the address in a browser. If it loads the image itself rather than a webpage around the image, it is likely a direct image URL.

Image URL vs. Website URL

An image URL and a website URL are both web addresses, but they can point to different types of resources.

Website URL Image URL
Usually opens a webpage Points to an image resource
May display text, menus, and other content Displays the image itself when accessed directly
Often used to share articles or pages Often used to embed or share images

For example, when I share an article, I usually want people to open the webpage.

When I share a screenshot from my notes, I may want them to see the screenshot directly, without having to navigate through another page.

That is where a direct image URL is useful.

How Does an Image URL Work?

When you open an image URL, your browser sends a request to the server hosting the image.

The server responds with the image data if the resource is available and you have permission to access it.

Here's a simple example of how an image can be displayed on a webpage:

Photo2URLStep-by-Step Guide.webp

The src attribute contains the image URL. The browser uses that address to load the image and display it on the page.

The alt attribute provides alternative text that can help users who cannot see the image and can also describe the image if it fails to load.

The image itself does not need to be stored in the same folder as the webpage. It can be hosted on another server, and the webpage can load it using its URL.

This is one reason external image hosting is useful for websites and documentation.

How to Get an Image URL

If you already have an image saved on your computer, you need to make it accessible online before you can share a public image URL.

Copying the file path from your computer won't work for other people. A path such as ~/Desktop/photo.jpg points to a file on your own device, not a publicly accessible image on the internet.

One option is to upload the image to an image hosting service.

For example, with Photo2URL, you can upload an image and get a URL that you can use to access or share it.

The basic process is:

1.Open the image hosting tool.
2.Upload the image you want to share.
3.Copy the image URL provided by the service.
4.Open the URL in a new browser tab to check that it works.

You can then use that URL in your notes, website, or documentation.

The exact access and availability of an image depend on the hosting service and its settings.

How to Use an Image URL in Markdown

This is one of the reasons I started using direct image URLs in my own workflow.

I use Obsidian for notes, and I often include screenshots to explain things or keep track of my work. When images are stored alongside everything else, the files can add up, especially when the same notes are synced or stored in a Git repository.

Markdown makes it possible to display an externally hosted image without keeping the image file in the same folder as the document.

The basic syntax is:

image.png

Replace the example URL with your actual image URL.

When a Markdown editor supports remote images, it can load the image from that address and display it inside the document.

This can be useful for:

Obsidian notes
GitHub README files
Technical documentation
Blog posts and website content

Keep in mind that the image must remain accessible at the URL. If the hosting service removes the image or changes its address, the Markdown link may stop working.

Can Anyone Open an Image URL?

Not always.

A public image URL can usually be opened by anyone who has the link, provided the image is still available and the hosting service allows public access.

However, some image URLs require a login, permission, or a temporary access token.

For example, a private cloud drive link may require the viewer to sign in or request permission. A temporary image URL may also expire after a certain period.

Before sharing an image URL, it is worth opening it in a private browser window or another browser where you are not signed in. This can help you check whether other people can access it.

Also, a direct image URL does not automatically guarantee that the original image quality is preserved. Some services resize or compress uploaded images, so check the hosting service's image handling if original quality matters.

Final Thoughts

An image URL is simply a web address that points to an image. But once you start using direct image URLs, they can make sharing images and working with notes or websites more convenient.

For me, the main benefit is keeping screenshots and other images separate from the notes and website files I work with, while still being able to use them through a link.

If you want to try this with your own images, you can use Photo2URL to upload an image and get a URL for sharing or embedding.

Sometimes a small change in how you store images can make your everyday workflow a little easier.

Top comments (0)