image combined with html file

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

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. :)

Re: image combined with html file

In our last episode,
the lovely and talented
broadcast on comp.infosystems.www.authoring.html:

Quoted text here. Click to load it

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>

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

<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:

<img src=""  ...>

will find yourimage.gif if it is in whatever directory 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     < <
              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_

Re: image combined with html file wrote:

Quoted text here. Click to load it

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 /
Whole-site HTML validation, link checking and more

Re: image combined with html file

On Tue, 25 Jul 2006 20:00:34 +0000, Nikita the Spider wrote:

Quoted text here. Click to load it

'MIME Encapsulation of Aggregate Documents, such as HTML (MHTML)' is RFC

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.


Re: image combined with html file

On Tue, 25 Jul 2006 11:54:59 -0700, lilcech wrote:

Quoted text here. Click to load it

As Lars said, basically you can't, since Internet Explorer doesn't
support data: URIs. But other browsers do, see
for more info (I won't explain further, as it isn't going to be much use
to you).


Re: image combined with html file

Quoted text here. Click to load it
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


Re: image combined with html file

Quoted text here. Click to load it

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.


Site Timeline