www.webdeveloper.com
Results 1 to 4 of 4

Thread: Is there any way to load an HTML image from memory instead of a physical file?

  1. #1
    Join Date
    Dec 2010
    Posts
    8

    Is there any way to load an HTML image from memory instead of a physical file?

    I am developing a mobile app using html/css/js; this app needs to capture images using phone's camera and perform some actions on the images.
    Since I am using js, which by definition and design does not and can not have I/O functions, I keep the images in memory. However, when I try to display the pictures, using <IMG SRC='...'> it seems that the only way for HTML to load an image is from a physical, disk-based file. Since the trivial solution (to create a "RAM disk" and put these "files" there) is not accessible from html/css/js platform, I wonder if someone else have had this problem before.
    Any help will be greatly appreciated, thanks in advance.

  2. #2
    Join Date
    Jul 2009
    Posts
    45
    Hmm, I know you can use base64 strings as an image source, I'm not sure if this can help you, but if you looked into this it might help. Good Luck.

    Code:
    <img src='data:image/gif;base64,...'/>

  3. #3
    Join Date
    Dec 2010
    Posts
    8
    Thanks for your response, I have already tried that and it does not work. It's odd, because it should.

  4. #4
    Join Date
    Jul 2009
    Posts
    45
    Not knowing more about what you're developing (an app I'd imagine), is there no way on the starting end (i.e. where you first put the image into the memory), to first convert it to a base64 string, and then store the string in the memory? Or is this what you said you have already tried? It seems as if it's just reading the string from the memory and not trying to call the actual data with that method, that it should work.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles