The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Put the image in your web project, then reference it with an <img> element whose src is a path relative to the HTML document’s base URL:
<img src="photo.jpg" alt="A description of the photo">
That example works when photo.jpg is beside the HTML file. For an image in an images folder, use src="images/photo.jpg". The spelling, extension, folder names, and capitalization must match the actual file. If a visitor—not the site author—must choose an image from their computer, use a file input and JavaScript instead; a page cannot guess or prefill an arbitrary local path.
1. Add an image that belongs to your project
Organize the files first. A simple project might be:
project/
index.html
images/
photo.jpg
With that structure, index.html contains:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Local image example</title>
</head>
<body>
<img src="images/photo.jpg" alt="A description of the photo">
</body>
</html>
If the file is in the same directory as index.html, remove the folder name:
Free tools Windows power users keep installed
One-click scans. No signup required.
#1 Best Overall
- CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
- INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
- THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
- WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
- A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents
<img src="photo.jpg" alt="A description of the photo">
The src value is a URL/path, not a label. A browser resolves a relative path from the document’s base URL. A <base> element, if your page has one, changes that base. This is why a path that looks correct can fail after moving a page into a different folder.
Use the exact filename
images/photo.jpgis different fromimage/photo.jpg.photo.jpgis different fromphoto.jpegandphoto.JPGon case-sensitive systems.- Spaces and unusual characters can make URLs harder to diagnose; simple lowercase names with hyphens are easier to maintain.
2. Write useful alternative text
alt communicates the image’s content or purpose to people who cannot see it and appears when the image cannot load. Describe what matters in the context of the page, not every visible detail. For example:
<img src="images/team.jpg" alt="Four engineers reviewing a circuit board">
If the image is purely decorative and conveys no information, use an empty value:
<img src="images/ornament.svg" alt="">
Do not omit alt; an empty value intentionally marks an image as decorative, while a missing attribute leaves its purpose unclear to assistive technology.
3. Reserve space with width and height
When the intrinsic dimensions are known, include them:
Rank #2
- CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
- 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
- SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
- INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
- THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
<img
src="images/photo.jpg"
alt="A mountain trail at sunrise"
width="1200"
height="800">
The browser can calculate the aspect ratio and reserve space before the file arrives, reducing layout movement. These attributes do not have to force the image to render at that exact CSS size; CSS can scale it while preserving the ratio:
img {
max-width: 100%;
height: auto;
display: block;
}
For a fixed thumbnail, use a wrapper or an explicit crop policy rather than distorting the source:
.thumbnail {
width: 240px;
aspect-ratio: 3 / 2;
object-fit: cover;
}
4. Understand relative paths, parent folders, and absolute URLs
Images below the HTML file
From pages/about.html, an image in pages/images/logo.png is:
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
<img src="images/logo.png" alt="Company logo">
Images above the HTML file
To reach a sibling folder from pages/about.html when the image is in images/logo.png at the project root, go up one level:
<img src="../images/logo.png" alt="Company logo">
Each .. means “the parent directory.” Count from the folder containing the HTML file, not from the project root you have open in your editor.
Rank #3
- Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
- Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
- Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
- In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
- Ultra-thin bezels: Maximize your viewing experience with thin bezels.
Root-relative and absolute URLs
A path beginning with /, such as /images/logo.png, is relative to the website’s domain root when served over HTTP. It is not generally the right choice for a page opened directly from disk because a file:// page has no normal site root. A complete URL such as https://cdn.example.com/photo.jpg references a remote resource and is not a bundled local project asset.
5. If you mean “let the visitor choose a local image”
HTML cannot silently read an arbitrary path on a visitor’s computer. The visitor must explicitly select a file through a file picker. Use an <input type="file">, then create a temporary object URL for a preview:
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →<label for="image-file">Choose an image</label>
<input id="image-file" type="file" accept="image/*">
<img id="preview" alt="Selected image preview" hidden>
<script>
const input = document.querySelector('#image-file');
const preview = document.querySelector('#preview');
let previousUrl;
input.addEventListener('change', () => {
const file = input.files[0];
if (!file) {
preview.hidden = true;
return;
}
if (previousUrl) URL.revokeObjectURL(previousUrl);
previousUrl = URL.createObjectURL(file);
preview.src = previousUrl;
preview.hidden = false;
});
</script>
input.files contains the files the user selected. URL.createObjectURL(file) creates a browser-managed temporary URL; revoke the previous URL when replacing it so repeated selections do not retain unnecessary resources. This previews the file locally. Uploading it to a server is a separate operation requiring a form submission or an API.
Validate before previewing or uploading
The accept="image/*" hint filters the picker but is not a security boundary. Check the selected file’s type and size in JavaScript for a better user experience, and validate again on the server if you upload it. Never trust a filename or MIME type supplied by a client as proof that the bytes are safe.
6. Test pages opened from disk versus a local server
Double-clicking index.html opens a file:// URL. Relative image paths can work there, but local-file resource and security behavior varies by browser and operating system. If the image fails or scripts behave differently, serve the project through a local development server instead. The important test is that the server’s document URL and folder layout match how the site will be deployed.
Rank #4
- CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
- SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
- MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
- KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
- INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient
- Confirm the image is inside the project directory that the server exposes.
- Open the page’s developer tools and inspect the failed image request.
- Read the requested URL and compare every directory, character, extension, and capitalization with the real file.
- Reload without a stale cache after renaming or replacing the image.
7. Troubleshoot a broken image
The browser shows a broken-image icon
- Wrong base folder: Calculate the path from the HTML file’s directory. Add or remove
../as required. - Typo or case mismatch: Copy the filename from the file manager or editor and check the extension.
- File is outside the served project: Move it under the directory your development server publishes.
- A
<base>element changes resolution: Inspect the document head and adjust the path for that base URL.
The image appears but looks stretched
Set height: auto for proportional scaling, or use object-fit: cover when a deliberate crop is required. Do not solve a layout problem by changing only one of the HTML dimensions.
The preview stays blank after file selection
Check that the event listener runs, that input.files[0] exists, and that the preview’s hidden property is cleared. If you reuse object URLs, revoke the old URL only after assigning the new one—not before.
It works on one computer but not after deployment
Deployment commonly exposes case errors that a case-insensitive local filesystem hides. Verify the uploaded file’s exact case and inspect the network request on the deployed page. Also check whether your hosting setup rewrites document URLs, because rewrites can change the relative base.
8. Performance and reliability choices
- Choose an appropriate image format and dimensions before shipping; a camera-original file is often much larger than its display size.
- Keep intrinsic
widthandheightaccurate so layout space is reserved. - Use responsive CSS such as
max-width: 100%to prevent overflow on narrow screens. - Use
loading="lazy"for images that are well below the initial viewport, but do not defer the primary image a visitor needs immediately. - Keep project assets under predictable folders and use consistent lowercase naming.
Before publishing, verify both the source path and the deployed URL. A valid HTML element cannot compensate for a file that was never copied to the server.
9. A compact decision guide
| Need | Use | Important detail |
|---|---|---|
| Show a known project image | <img src="relative/path.jpg"> |
The path is relative to the document’s base URL. |
| Show an image selected by a visitor | File input plus JavaScript object URL | Explicit user selection is required; arbitrary local paths cannot be prefilled. |
| Decorative artwork | alt="" |
Use an empty alternative text value only when it adds no information. |
| Prevent image-related layout movement | Accurate width and height |
The browser can reserve the correct aspect ratio before loading. |
Or skip the browser setup
If your goal is to obtain a clean image of a web page rather than embed a project asset, ScreenshotNeo provides a website screenshot API and MCP server. One GET request returns a PNG, JPEG, WebP, or PDF. Its capture can accept consent banners before removing more than 60 known consent platforms, newsletter popups, and chat widgets; each cleanup step can be disabled. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers report the page verdict and billing status.
Recommended Free Tools
See the parameter reference in the ScreenshotNeo documentation. The supplied cURL example is:
Best Value
- 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
- 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
- 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
The same request in Python:
import requests
r = requests.get(
"https://api.screenshotneo.com/v1/shot",
params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"},
timeout=90,
)
r.raise_for_status()
open("shot.webp", "wb").write(r.content)
And Node.js:
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`Screenshot failed: ${res.status}`);
const buffer = Buffer.from(await res.arrayBuffer());
await import('node:fs/promises').then(fs => fs.writeFile('shot.webp', buffer));
ScreenshotNeo also has an MCP server for Claude, Cursor, and other MCP clients, so an AI agent can call take_screenshot, get_page_info, or capture_pdf. Every plan includes its features; 1,000 screenshots per month are free with no card, and paid plans start at $5 for 3,000. Create a free ScreenshotNeo account to get started.
Frequently Asked Questions
Can I use a Windows or macOS file path in src?
No. A path such as C:\Users\Me\photo.jpg or /Users/me/photo.jpg is not a portable web URL. Put the asset in the served project and reference it with a relative URL, or let the visitor select it with a file input.
Do I need JavaScript to display an image shipped with my website?
No. A normal project image needs only an <img> element and a correct src. JavaScript is needed for interactive tasks such as previewing a file chosen by a visitor.
Why does changing the HTML file’s folder break the image?
Relative URLs are resolved from the document’s base URL. Moving the HTML file changes that starting directory, so the same src may point to a different location.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




