Send images in the mail body from unix - html

I am trying to send an image through html coding
<!DOCTYPE html>
<html>
<body>
<style>
body {background-color:blue}
</style>
<h1>hello</h1>
<h4>hello</h4>
<center>
<img src="C:\Users\dubasir\Desktop\New folder\we.jpg" width="1200" height="800">
</center>
This is a linking
<p>jfklkskflksdlfklsdmklm</p>
</body>
</html>
how to run it unix and get the image in mail body.

You're using an absolute Windows file name for the image. This can't work - the receiving computer has no way to know where on the world that image is stored.
Instead, you need to attach the image to the mail. Give it a name, say we.jpg. Now you can use this HTML code to use it in the mail body:
<img src="cid:we.jpg" />
Here us an example how the raw mail would look like: Can an HTML email body reference a file sent as an attachment (in the same email)?

i believe you forgot to end the image tag, this is done as follows:
<img src="path/blah.jpg" height="100" width="100"/>
that slash before you end the tag is needed to close the image tag

Related

HTML image won't appear

I am using the following code to attempt to place an image of myself into my personal website:
<!DOCTYPE html>
<html>
<head>
<title>My Page</title>
</head>
<body>
<center>
<img src = "/photos/mainphoto.jpg" alt = "Test Image"/>
<h1>My Page</h1>
<hr />
<p> To be updated.</p>
</center>
</body>
</html>
The photos directory is in the same directory as the html page. I have tried placing the photo in the same directory as the html page and it doesn't work. I have tried using .JPG instead of .jpg. I have tried executing the code without the alt tag. I have tried using backslashes instead of forward slashes in the file path. I have looked for typos in the filename and there are none. I feel like my current code should be working with no problems. But the image will absolutely not show up. Any ideas or help would be greatly appreciated.
EDIT: I have corrected the code above to fix an elementary mistake, namely including the body inside of my head instead of separating the two. The picture still does not show.
The HTML structure needs to be:
<html>
<head>
</head>
<body>
</body>
</html>
You are putting the body tag inside the head tag.
Also, if the images directory is in the same one than the html, you need to remove the first slash, just use photos/mainphoto.jpg
So you can try:
<!DOCTYPE html>
<html>
<head>
<title>My Page</title>
</head>
<body>
<center>
<img src="photos/mainphoto.jpg" alt="Test Image"/>
<h1>My Page</h1>
<hr />
<p> To be updated.</p>
</center>
</body>
</html>
Also I recommend you not to use any spaces before or after the equal signs, these are good practices.
Well, your code is like this
<!DOCTYPE html>
<html>
<head>
<title>My Page</title>
<body>
<center>
<img src = "/photos/mainphoto.jpg" alt = "Test Image"/>
<h1>My Page</h1>
<hr />
<p> To be updated.</p>
</center>
</body>
</head>
</html>
You have <body> element inside your <head> element.
It should be like this
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<center>
<img src = "/photos/mainphoto.jpg" alt = "Test Image"/>
<h1>My Page</h1>
<hr />
<p> To be updated.</p>
</center>
</body>
</html>
And for that image, the address must start from your html file.
So if you have structure like this
web/
index.html
photos/
cutePuppy.png
You will have <img src="photos/cutePuppy.png" alt="Cute puppy">
Try using the full path of the image listed in its properties.
FIXED
In the Windows 10 filesystem, the picture file extensions are evidently hidden. I had named the picture "mainphoto.jpg", without realizing that the Windows 10 filesystem had already automatically added a .jpg extension, which was hidden in the file structure. Therefore, the name of the file being referenced was actually "mainphoto.jpg.jpg".
Apologies for the silly mistake, and thank you to everybody who offered suggestions!
Does it show as 404(not found) in the web inspector of the browser you are using. Chances are that the folder with the image and possibly the image it self don't have permissions great enough to allow access. You will have to change the permissions via terminal or possible in the editor(IDE) you are using.

can't add image to HTML

i am struggling to add any images whatsoever to html, for them to show when i open in browser
i have tried different images, using them in the correct directories, relative and absolute url
i really do not know why im getting nothing to show...
<!DOCTYPE html>
<html>
<head>
<title> how to</title>
</head>
<body>
<div>
<img src="‪https://static1.squarespace.com/static/503264b0e4b0dbdecd41e3f6/t/590a05131e5b6ce08768b593/1493828890055/polaroid2.png"/>
</div>
</body>
</html>
even the image address copied won't show
any ideas???
As shown in the figure below, there is a special character in your url, causing the browser to treat it as a file on your server instead of on squarespace. Remove that, and your image should be displayed as normal.
<body>
<div>
<img src="https://static1.squarespace.com/static/503264b0e4b0dbdecd41e3f6/t/590a05131e5b6ce08768b593/1493828890055/polaroid2.png"/>
</div>
</body>
This seems to work, deleted first double quotes and then added it back
Or delete the first quotes and then the first h to be sure, then retype

Not able to load image in html via jsp:include

I have 1 JSP page and 1 HTML page. I am including that HTML page in JSP dynamically like below.
<jsp:include page="<%=htmlPageURL%>" flush="true" />
The htmpPageUrl value is /temp/1232334333.html
In 1232334333.html, I have an image tag:
<img width=135 height=48
src="1232334333_files/image003.jpg"> </img>
Here is the folder structure:
MyWebApp/temp/1232334333.html
MyWebApp/temp/1232334333_files/image003.jpg
The problem is when I include the HTML page in JSP, it displays all the text fine, but could not load the image.
My understanding:
As I include HTML in JSP, all image paths should be relative to my JSP and not my HTML. But I really can't change HTML source. Is there any way to handle this scenario?
img tag is in correct.
Wrong: <img width=135 height=48 src="1232334333_files/image003.jpg" </img>
Correct
<img width=135 height=48 src="1232334333_files/image003.jpg"/>
If you don't have access to your .html page to modify the source, then you can try to modify it using jQuery in your .jsp file. If you know the position of the <src /> tag (i supposed it's in the first position after the page is included), when you can do as follows:
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("img:first").attr("src","/temp/1232334333_files/image003.jpg");
var src = $("img:first").attr("src");
alert(src);
});
</script>
</head>
<body>
<!-- The following image is inserted after the <jsp:include /> function is processed -->
<img width=135 height=48 src="1232334333_files/image003.jpg" />
</body>
</html>
The alert function will display /temp/1232334333_files/image003.jpg.
I'm not sure if it will work, but it's worth a try.
<base> tag does the trick for me.
e.g. <base href="http://localhost:8080/MyWebApp/temp"></base>

Create a hyperlink that opens multiple images in one page using html

How can I create a clickable link that opens multiple images in one page only? I host all my images in photobucket. I was able to create a link to open one image only but not multiple images simultaneously.
Keep all 6 files in same directory
Image1(Name:html1.html)
<html><body>
<img src="/image1.jpg"><br>
</body></html>
Image2(Name:html2.html)
<html><body>
<img src="/image2.jpg"><br>
</body></html>
Image3(Name:html3.html)
<html><body>
<img src="/image3.jpg"><br>
</body></html>
Image4(Name:html4.html)
<html><body>
<img src="/image4.jpg"><br>
</body></html>
Image5(Name:html5.html)
<html><body>
<img src="image5.jpg"><br>
</body></html>
Main html
<html><body>
image1
image2
image3
image4
image5
</body></html>
I am a newbie and just a 12-year old boy.
Apologies for any mistakes
put your images inside a sperated html file like "images.html"
and link the hyperlink to that page
click me
this is HTML sample page: put all images in images folder in the same HTML page root directory
<html>
<head></head>
<body>
<img src="/images/01.jpg"/> <br>
<img src="/images/01.jpg"/> <br>
<img src="/images/01.jpg"/> <br>
<img src="/images/01.jpg"/> <br>
</body>
</html>
Working Example : http://jsbin.com/eluqod/4/
You don't need to be an expert. If you have the basic knowledge of HTML and JavaScript you can do it on your own. The easiest option is to use jQuery framework, it's a less write, do more JavaScript library that makes interactive web design easy.
What you have to do is create a <div> container and put all your images using HTML's <img> now you have to include the jQuery library in your document
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
Now use the hide and show or any other effects like FadeToggle, SlideToggle etc. effects (http://api.jquery.com/category/effects/) to toggle hide and show for the image container div. Setup your complete page with the image container and the link, first hide the image container using display:none; and now use the jQuery function to trigger a function on click of that anchor element.
This is the jQuery
$(document).ready(function(){
$('#showimg').on('click',function(){
//Trigger FadeToggle function on click
$('.image-container').fadeToggle();
});
});
And the HTML
<a id='showimg'>Hide/Show Images</a>
<div class='image-container' style='display:none;'>
<img src='images/sample.png'/>
<img src='images/sample.png'/>
<img src='images/sample.png'/>
<img src='images/sample.png'/>
<img src='images/sample.png'/>
</div>
Do remember to add the JavaScript library in your page.
check the code to learn about it: http://jsbin.com/eluqod/4/edit
You have to create different HTML files for all your image sets. You don't only have create the HTML files, you also have to upload those HTML documents online on a server so people can access it from anywhere.
1. Create an HTML file
Open notepad or any plain text editor and paste this in your file
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Your page title</title>
<style type='text/css'>
.image-container {text-align:center;}
img {width:80%;height:auto;display:block;margin:10px auto;border:2px solid black;padding:5px;}
</style>
</head>
<body>
<h2> The first 50 pictures (or whatever title you want)</h2>
<!-- Images below -->
<div class='image-container'>
<!-- Each images are in img tag, put the photobucket images link into the src attribute. Repeat the img tags if you want more images -->
<img src='http://i923.photobucket.com/albums/ad77/kihani_1996/Troll_Face_.png'/>
<img src='http://i923.photobucket.com/albums/ad77/kihani_1996/Troll_Face_.png'/>
<img src='http://i923.photobucket.com/albums/ad77/kihani_1996/Troll_Face_.png'/>
</div>
</body>
</html>
And save it with an understandable name ending with .html [name].html and save type as All Files - Make sure to save the file with encoding UTF-8. Just make the necessary changes and upload it to a server and link it.
Repeat the steps for more other HTML files with different images in it.

html page not showing image in browser

i am using html to create a page. but the problem i am facing is i am not geeting the image. my code is as:
<html>
<head runat="server">
<title>Untitled Page</title>
</head>
<body style = " background:#FFA500">
<form id="form1" runat="server">
<div>
<h1>
header_picture
</h1>
<img src="C:/Documents and Settings/All Users/Documents/My Pictures/Sample Pictures/Water lilies.jpg" />
</div>
<div>
<h1>
here comes the content
</h1>
</div>
<div>
<h2>
footer_picture
</h2>
<img src="C:/Documents and Settings/All Users/Documents/My Pictures/Sample Pictures/Blue hills.jpg" />
</div>
</form>
</body>
</html>
but it is not showing me the images when i run this html file in browser..
please help me out..
is this possible to give image url on run time in <img src> tag in html file.. if yes how can we do that..
You should change C:/Documents and Settings/All Users/Documents/My Pictures/Sample Pictures/Water lilies.jpg to file:///C:/Documents and Settings/All Users/Documents/My Pictures/Sample Pictures/Water lilies.jpg and the same with your other URL too.
Referencing local files from a non-file:// location (even if it's localhost) is no longer possible in many modern browsers for security reasons.
Chrome for example will throw the following error in its console:
Not allowed to load local resource: file:///C:/path/to/filename
You would have to put the HTML file into a local folder (which is probably not what you want because you have server-side code in it) or move the images to a location that you can call through your web server.