473,395 Members | 1,412 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

image combined with html file

How can i cobine my image with a html file so i only have one file. The
image is used inside the html file so if i delete it or move it, then
it wont show up in the html file. :)

Jul 25 '06 #1
6 1899
In our last episode,
<11*********************@s13g2000cwa.googlegroups. com>,
the lovely and talented li*****@gmail.com
broadcast on comp.infosystems.www.authoring.html:
How can i cobine my image with a html file so i only have one file. The
image is used inside the html file so if i delete it or move it, then
it wont show up in the html file. :)
Basically, you can't. HTML is a form of text. Most image formats are
binaries (there are a few that are encoded in text, but there is no
way to tell a browser "take the following text as a <someformat>
image."

You can make the src link in the IMG element relative, so if you move
both files, maintaining the same relation between them, the image will
still show up. On the other hand, if you give the src as a complete
url, the image will show up wherever you move the html.

for example
1)
<img src="myimage.gif" ....will allow the browser to find the image if it
is the same directory as the html file, and this will work not matter where
that directory is. If you browser can find the html, it can find the image
in the same directory, permissions permitting. (There are a few execeptions
and qualifications here, none of which I think you are ready to hear.)

on the other hand:

2)
<img src="http://yourdomain.com/images/yourimage.gif" ...>

will find yourimage.gif if it is in whatever directory
http://yourdomain.com/images/ points to. Wherever you move the html,
if the browser will try to look for the image in that place. The problem
with this if you ever move the image, the src has to be changed everyplace
you have entered the complete uri.

In other words, 1) will work if you move both the html and the image
together, and you don't have to change anything in the url.
2) will work wherever you move the html, but will stop working if you
ever move the image.

In most cases 1) is the best choice. If you use only relative links,
you can move a whole site without having to change any html.
--
Lars Eighner <http://larseighner.com/ <http://myspace.com/larseighner>
War on Terrorism: Bad News from the Sanity Front
"There's one thing ... that I do like about Rumsfeld, he's just a little bit
crazy, OK"? --Thomas Friedman, _The New York Times_
Jul 25 '06 #2
On Tue, 25 Jul 2006 11:54:59 -0700, lilcech wrote:
How can i cobine my image with a html file so i only have one file. The
image is used inside the html file so if i delete it or move it, then it
wont show up in the html file. :)
As Lars said, basically you can't, since Internet Explorer doesn't
support data: URIs. But other browsers do, see
http://en.wikipedia.org/wiki/Data:_URI_scheme
for more info (I won't explain further, as it isn't going to be much use
to you).

--
Matt

Jul 25 '06 #3
In article <11*********************@s13g2000cwa.googlegroups. com>,
li*****@gmail.com wrote:
How can i cobine my image with a html file so i only have one file. The
image is used inside the html file so if i delete it or move it, then
it wont show up in the html file. :)
I believe both Firefox and IE can create some sort of "compiled HTML"
which packages a whole Web page (HTML, CSS and images) into one file.
However, be aware that these are proprietary standards that won't work
on the public Internet. If you're the only one who will ever have to
deal with these files, then that might be a workable solution for you.
But if you're talking about files that you'll put up on a Web site, then
there's no way to do what you're asking.

--
Philip
http://NikitaTheSpider.com/
Whole-site HTML validation, link checking and more
Jul 25 '06 #4
PTM
<li*****@gmail.comwrote in message
news:11*********************@s13g2000cwa.googlegro ups.com...
How can i cobine my image with a html file so i only have one file. The
image is used inside the html file so if i delete it or move it, then
it wont show up in the html file. :)
as the other guys have said you can't.

but what you could do is use JavaScript or php (if your host has it
installed) to do a check to see if the pic file exists
if the file is there you add the 'img' tag to format your pic, if not you
don't do anything. or you display something else

hope this helps

Phil
Jul 25 '06 #5
In article <11*********************@s13g2000cwa.googlegroups. com>,
<li*****@gmail.comwrote:
>How can i cobine my image with a html file so i only have one file. The
image is used inside the html file so if i delete it or move it, then
it wont show up in the html file. :)
Why would you want to do away with the flexibility of substituting
different images in your pages?

Anyway, the way to do it that's most compatible with all browsers
is to create a .pdf file from your web page. Then you get all the
text and images in one file, which is readable by the majority of
browsers. You can even have hyperlinks in it.

It's not what *I* would do though. I think it's a dumb idea; it's
far better to have relative links to your images, and then you
simply move your HTML files and images together.

-A
Jul 26 '06 #6
On Tue, 25 Jul 2006 20:00:34 +0000, Nikita the Spider wrote:
In article <11*********************@s13g2000cwa.googlegroups. com>,
li*****@gmail.com wrote:
>How can i cobine my image with a html file so i only have one file. The
image is used inside the html file so if i delete it or move it, then it
wont show up in the html file. :)

I believe both Firefox and IE can create some sort of "compiled HTML"
which packages a whole Web page (HTML, CSS and images) into one file.
However, be aware that these are proprietary standards that won't work on
the public Internet. If you're the only one who will ever have to deal
with these files, then that might be a workable solution for you. But if
you're talking about files that you'll put up on a Web site, then there's
no way to do what you're asking.
'MIME Encapsulation of Aggregate Documents, such as HTML (MHTML)' is RFC
2557: http://tools.ietf.org/html/rfc2557

A brief experiment -- serving a file saved with Opera in 'MHTML' format,
putting it on a web server and viewing it -- failed, I don't know what
MIME type I should serve it with.

--
Matt

Jul 26 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: dave | last post by:
Hello there, I am at my wit's end ! I have used the following script succesfully to upload an image to my web space. But what I really want to be able to do is to update an existing record in a...
4
by: tvmaly | last post by:
Does anyone know if it is possible to determine if an image is horizontal/vertical and color or black & white using the python image library? I have been searching this news group and the...
13
by: lkrubner | last post by:
Suppose I need to get an image as a stream of bytes. I want to store this in a variable and then embed it in some Postscript code. In my Postscript code, the image might look like this: {<...
9
by: Lars Netzel | last post by:
Hey! Is there any possibility to render images for the web in asp.net? Is it hard? Is there something built in or do I need external commercial components? best regards /Lars
11
by: Chris Beall | last post by:
See http://pages.prodigy.net/chris_beall/Demo/photo%20block%20experiments.html I've ended up with what seems like a rather complex structure for what I thought would be a somewhat simple...
10
by: =?Utf-8?B?UmludSBHb3BhbGFrcmlzaG5hIFBpbGxhaQ==?= | last post by:
Hi, Please help me to write a dll in C# , that will read each pages of a tiff image from a file and a memory stream object ( need two ways) and creatre a new tiff image object.The dll should...
0
prabunewindia
by: prabunewindia | last post by:
hi friends, i am trying to add one image with another image. converted bith image into byte array and combined both as one and open that one. but only one image i am getting. this is the code i...
5
by: Bern McCarty | last post by:
We upgraded a bunch of MEC++ code to C++/CLI about 11 months ago and we've noticed that our images bloated quite a lot in the process. Upon investigating I observed that when a /clr compiland...
1
by: sarran rangarajan | last post by:
Hi, i have collection of memorystream. I need to write (generate) an image based on data that is present in all memorystreams. string p = string.Format(@"C:\temp\{0}-Page.gif", messageId);...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.