1. View the properties of the images in the Images/Responsive folder that you downloaded from Canvas a. Append the width of each image to the file name of each image file- separate the original file name and width using a hyphen (ex: if the image name is BigCat.png and it has a width of 100px then rename it to BigCat-100.png)
this is what I have so far
<!DOCTYPE html>
<html>
<head>
<meta charset=”utf-8”>
<title>Lab3</title>
</head>
<body>
<h1>Images</h1>
<img
src="C:\Users\332bo\Desktop\Week_3_Lab\images/meeting-5793.jpg"
alt="A meeting"
width="100%">
<img
src="https://images.unsplash.com/photo-1631130576582-2119bf5189e3?ixid=MnwxMjA3fDB8MHx0b3BpYy1mZWVkfDF8MjFhcGMzVFVFVm98fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=60"
alt="chair"
width="100%">
<img
src="C:\Users\332bo\Desktop\Week_3_Lab\images\responsive"
alt="sizes"
srcset="xl-box.png,
s-box.png,
m-box.png,
l-box.png"
sizes="100vw">
</body>
</html>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
![Variable Width Images:
1. View the properties of the images in the Images/Responsive folder that you
downloaded from Canvas
a. Append the width of each image to the file name of each image file - separate
the original file name and width using a hyphen (ex: if the image name is
BigCat.png and it has a width of 100px then rename it to BigCat-100.png)
2. Below the second image in index.html, add one Image Embed element
a. Use w-descriptors and all images in the Responsive folder to add responsive
behavior to this element so that the browser renders the optimal image file
based on the image width and viewport size
b. Some browsers don't support modern, responsive HTML attributes – to handle
this, have the Image element default to the largest image in the Responsive
folder
c. Add a "sizes" attribute to this element with a value that fills half the viewport
width](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F7a7c98c4-bc43-4885-a65b-022529706266%2F1c50f59d-670e-49eb-b0bf-dd096ec04d13%2Fiph1jn7_processed.png&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Our guidelines,we answer only first one.
===========================================================
here intially we write code to extract the extension and image name.
then we append the width in url.
==============================================
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript Strings</h2>
<p>The substring() method extracts parts of a string.</p>
<p id="demo"></p>
<script>
width=100;
let str = "/user/name/folder/5467.png";
image_name1 = str.substring(str.lastIndexOf('/')+1,str.length - 4);
extension = str.substring(str.length - 4);
image_name = image_name1+"-"+width+extension
document.getElementById("demo").innerHTML = image_name;
</script>
</body>
</html>
==========================
output:
Step by step
Solved in 2 steps with 2 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
![Concepts of Database Management](https://www.bartleby.com/isbn_cover_images/9781337093422/9781337093422_smallCoverImage.gif)
![Prelude to Programming](https://www.bartleby.com/isbn_cover_images/9780133750423/9780133750423_smallCoverImage.jpg)
![Sc Business Data Communications and Networking, T…](https://www.bartleby.com/isbn_cover_images/9781119368830/9781119368830_smallCoverImage.gif)