image from within document itself

Discussion in 'HTML' started by Asterbing, Apr 28, 2006.

  1. Asterbing

    Asterbing Guest

    How to display image data embedded in the html page itself. Seen <img
    src:"data:image/gif;base64,...">, but it doesn't work in IE. How to do ?
    What workaround ?
     
    Asterbing, Apr 28, 2006
    #1
    1. Advertising

  2. Asterbing wrote:

    > How to display image data embedded in the html page itself.


    Use data URLs.

    > Seen <img src:"data:image/gif;base64,...">, but it doesn't work in IE.


    Correct.

    > What workaround ?


    There isn't one. Use an external resource.

    --
    David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
    Home is where the ~/.bashrc is
     
    David Dorward, Apr 28, 2006
    #2
    1. Advertising

  3. Asterbing

    Jim Higson Guest

    Asterbing wrote:

    > How to display image data embedded in the html page itself. Seen <img
    > src:"data:image/gif;base64,...">, but it doesn't work in IE. How to do ?
    > What workaround ?


    Those are data URLs. There is no workaround to get them showing in IE,
    except to fall back on 'normal' http URLs.

    --
    Jim
     
    Jim Higson, Apr 28, 2006
    #3
  4. On Fri, 28 Apr 2006, Jim Higson wrote:

    > Asterbing wrote:
    >
    > > How to display image data embedded in the html page itself. Seen <img
    > > src:"data:image/gif;base64,...">, but it doesn't work in IE. How to do ?
    > > What workaround ?

    >
    > Those are data URLs.


    Quite suitable for small images, but a bit wasteful of space for
    larger ones[1]

    > There is no workaround to get them showing in IE,


    indeed

    > except to fall back on 'normal' http URLs.


    You could use conditional comments, so that compatible client agents
    "see" only the embedded data, and don't have to make an additional
    HTTP transfer, whereas the operating system component that thinks it's
    a web browser will perceive the external link instead.

    If you cared enough, that is.

    regards

    [1] Most current browsers support gzipped HTML, so feel free to
    offer pages in that format if you'd like to conserve space and
    bandwidth. Or use mod_gzip to negotiate it.
     
    Alan J. Flavell, Apr 28, 2006
    #4
  5. Asterbing

    Asterbing Guest

    In article <>,
    says...
    > How to display image data embedded in the html page itself. Seen <img
    > src:"data:image/gif;base64,...">, but it doesn't work in IE. How to do ?
    > What workaround ?
    >


    Well, thanks David, Jim and Alan, but it seems it's a no way problem.
    Elsewhere, I've seen some solutions going with <OBJECT> or XBM
    conversion or MIME encapsulation... But I think I'll go to something
    easier like a POST (afraid of GET because of lengh url limitation,
    knowing my largest images may be of 10KB, while smallest 50 bytes) of
    the image data toward a cgi which will sent it back to browser in tne
    framework of an <img> tag.
     
    Asterbing, Apr 29, 2006
    #5
  6. Asterbing

    Jim Higson Guest

    Asterbing wrote:

    > In article <>,
    > says...
    >> How to display image data embedded in the html page itself. Seen <img
    >> src:"data:image/gif;base64,...">, but it doesn't work in IE. How to do ?
    >> What workaround ?
    >>

    >
    > Well, thanks David, Jim and Alan, but it seems it's a no way problem.
    > Elsewhere, I've seen some solutions going with <OBJECT> or XBM
    > conversion or MIME encapsulation... But I think I'll go to something
    > easier like a POST (afraid of GET because of lengh url limitation,
    > knowing my largest images may be of 10KB, while smallest 50 bytes) of
    > the image data toward a cgi which will sent it back to browser in tne
    > framework of an <img> tag.


    It's not clear what you're trying to do. Care to share?

    --
    Jim
     
    Jim Higson, Apr 29, 2006
    #6
  7. Asterbing

    Asterbing Guest

    In article <>, says...
    > It's not clear what you're trying to do. Care to share?
    >


    Not clear because not written what I've in mind yet, so you've just get
    my idea how it is at the moment I'm posting.

    If I did choosen the GET way, it would be something easy like : <img
    src='display_image.cgi?$img_data'>, but sure I'll be not able to pass
    binary data (even base64 encoded) like this in url... Then, I'll try to
    do it like a form POST will do...

    Not sure it will work, not done at this time
     
    Asterbing, Apr 29, 2006
    #7
  8. Asterbing

    Toby Inkster Guest

    Asterbing wrote:

    > How to display image data embedded in the html page itself. Seen <img
    > src:"data:image/gif;base64,...">, but it doesn't work in IE. How to do ?
    > What workaround ?


    Yes, it can be done. You'll need:

    1. A small server-side script that can do base64 decoding;

    2. A small client-side script that Internet Explorer will
    run, that performs the following tasks:

    * Finds all data:URLs
    * For each of them, rewrites it to point to
    the server-side script, calling it using the
    base64-encoded data as a parameter.

    e.g.
    http://dean.edwards.name/weblog/2005/06/base64-ie/
    http://www.kryogenix.org/days/2003/10/18/embedding

    Reminds me -- I keep meaning to add "data:" URLs to my chess board.

    http://examples.tobyinkster.co.uk/chess/

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me ~ http://tobyinkster.co.uk/contact
    Now Playing ~ ./ed_harcourt/from_every_sphere/04_the_birds_will_sing_for_us.ogg
     
    Toby Inkster, Apr 29, 2006
    #8
  9. Asterbing

    Jim Higson Guest

    Asterbing wrote:

    > In article <>, says...
    >> It's not clear what you're trying to do. Care to share?
    >>

    >
    > Not clear because not written what I've in mind yet, so you've just get
    > my idea how it is at the moment I'm posting.
    >
    > If I did choosen the GET way, it would be something easy like : <img
    > src='display_image.cgi?$img_data'>, but sure I'll be not able to pass
    > binary data (even base64 encoded) like this in url... Then, I'll try to
    > do it like a form POST will do...


    You certainly can pass data from the client to the server as a POST request.
    There is no absolute max length a GET request can post in the URL, but most
    apache servers have an 8k limit compiled in (you can have more, but you
    have to recompile)

    I have library code to do it both ways for an open source project I made.
    Interested?

    --
    Jim
     
    Jim Higson, Apr 29, 2006
    #9
  10. Asterbing

    Asterbing Guest

    In article <>, says...
    > I have library code to do it both ways for an open source project I made.
    > Interested?
    >


    Not sure to understand what you mean, Jim, but obviously interested to
    see closer. Do you have an url ? Or, if you prefer, here is an antispam
    email I've created these days : . Thanks
     
    Asterbing, Apr 29, 2006
    #10
  11. Asterbing

    Asterbing Guest

    In article <5n.co.uk>, usenet200604
    @tobyinkster.co.uk says...
    > Yes, it can be done. You'll need:
    >
    > 1. A small server-side script that can do base64 decoding;
    >


    OK, no pb about that (MIME::Base64 in Perl)

    > 2. A small client-side script that Internet Explorer will
    > run, that performs the following tasks:
    >
    > * Finds all data:URLs
    > * For each of them, rewrites it to point to
    > the server-side script, calling it using the
    > base64-encoded data as a parameter.
    >


    And what if base64-encoded image data langth is over the url query
    string limitation ?
     
    Asterbing, May 4, 2006
    #11
  12. Asterbing

    Toby Inkster Guest

    Asterbing wrote:

    > And what if base64-encoded image data langth is over the url query
    > string limitation ?


    Then you're stuck I'm afraid. :-(

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me ~ http://tobyinkster.co.uk/contact
     
    Toby Inkster, May 5, 2006
    #12
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tony Prichard
    Replies:
    0
    Views:
    741
    Tony Prichard
    Dec 12, 2003
  2. Manish Hatwalne
    Replies:
    1
    Views:
    401
    Martin Honnen
    Jul 13, 2004
  3. Replies:
    4
    Views:
    684
  4. mark4asp
    Replies:
    2
    Views:
    2,220
    Harry Haller
    Nov 7, 2006
  5. samppi
    Replies:
    1
    Views:
    412
    Martin Honnen
    Jan 6, 2008
Loading...

Share This Page