SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Zealot
    Join Date
    Feb 2005
    Posts
    134
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Arrow Is it possible to store an Image file in HTML file

    Is it possible to store an image file in an HTML. I mean something like the MHTML format in Windows.

    I would like to create a singe page that holds all the images inside, and to be able to parse it with PHP to display the HTML with images.

    Something like storing images in a database, and showing them directly from there.

  2. #2
    SitePoint Zealot CdeMky's Avatar
    Join Date
    Sep 2004
    Location
    United States
    Posts
    123
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by SUPERUSER
    Is it possible to store an image file in an HTML. I mean something like the MHTML format in Windows.

    I would like to create a singe page that holds all the images inside, and to be able to parse it with PHP to display the HTML with images.

    Something like storing images in a database, and showing them directly from there.
    I image you could transmit an image file as text via http, i don't know why you would want to though. Just rename your image as an html file and the resultant text file is the image but in text format. You can paste that garbage into another HTML file between your tags.

  3. #3
    SitePoint Wizard Dylan B's Avatar
    Join Date
    Jul 2004
    Location
    NYC
    Posts
    1,150
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's not worth the effort, I think.

  4. #4
    SitePoint Zealot
    Join Date
    Feb 2005
    Posts
    134
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So if I paste that garbage between the HTML tags the garbage is going to be displayed as garbage not as an Image.

    What I want is an HTML file/or a text file, that will contain the HTML code and the Images inside it. Then a PHP to parse the file and return a resulting HTML displaying the original images.

    I have an idea how this can be done. The PHP to read the text file, save the "garbage" to temporary image files, and then to show the HTML with the original images, displaying from the temporary files.

    I'm just wondering isn't there a way without extracting the image files.

  5. #5
    SitePoint Zealot CdeMky's Avatar
    Join Date
    Sep 2004
    Location
    United States
    Posts
    123
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by SUPERUSER
    So if I paste that garbage between the HTML tags the garbage is going to be displayed as garbage not as an Image.
    Exactly

    I have an idea how this can be done. The PHP to read the text file, save the "garbage" to temporary image files, and then to show the HTML with the original images, displaying from the temporary files.

    I'm just wondering isn't there a way without extracting the image files.
    Unless you tell the browser/php etc. what that garbage is, it won't know how to handle it. To the browser, http is simply sending it text/raw binary data as unprintable characters, it doesn't care if it is an image or not. It wont display an image unless you make sure it knows that the raw text actually constitutes an image. I saw some code somewhere in php that would build an image on the fly via a link like this:

    <img src='<? BuildImage(); ?>' /> or something of that nature, but you get the idea.

    To be honest, i'm not sure why you would want to embed images in HTML as text, when you can just link the binary imgage as normal. Is there some reason you don't want to deal with both an image and an HTML file ? I mean, in the end, you're going to have to anyhow.

  6. #6
    SitePoint Zealot
    Join Date
    Feb 2005
    Posts
    134
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What I have in mind is have a web page editor.

    The user is to be able to edit his files with images inside. Then he downloads the files and writes them to a disquette or CD.

    Next he goes to another PC, let's say in another country with another OS.

    He opens the web editor, loads the file and his original files comes out, with the images included.

    That is the simple idea.


  7. #7
    SitePoint Wizard REMIYA's Avatar
    Join Date
    May 2005
    Posts
    1,351
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Very interesting idea. If you find the solution to the problem, please, let us know.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •