Faked path - Smartphone.

Discussion in 'HTML' started by Mr. X., Jan 22, 2013.

  1. Mr. X.

    Mr. X. Guest

    Hello.
    When I do something like this:
    <input type="file" accept="image/*" capture ></input>

    I can attach a picture or camera on smartphones.

    This all fine,
    but what if I want to show the picture to the user who choose it.
    I created for that a <div> element and try to set the background-image to
    the file (which is on local computer or on local smarphone) -

    Then I got the path of :
    c:/fakepath/myfile.jpg.

    How can I solve the problem?
    The fake path - I cannot use as reference, and I don't know if I get instead
    of the path the image source in bits (so I can do something like
    data:image/png;base64,... a binary data ....)

    Thanks :)
    Mr. X., Jan 22, 2013
    #1
    1. Advertising

  2. "Mr. X." <> writes:

    > Hello.
    > When I do something like this:
    > <input type="file" accept="image/*" capture ></input>
    >
    > I can attach a picture or camera on smartphones.
    >
    > This all fine,
    > but what if I want to show the picture to the user who choose it.
    > I created for that a <div> element and try to set the background-image


    Why use a background image?

    > to the file (which is on local computer or on local smarphone) -
    >
    > Then I got the path of :
    > c:/fakepath/myfile.jpg.
    >
    > How can I solve the problem?
    > The fake path - I cannot use as reference, and I don't know if I get
    > instead of the path the image source in bits (so I can do something
    > like data:image/png;base64,... a binary data ....)


    Yes, many browsers support these data pseudo-URLs in the src attribute
    of an img element. I have not used them is CSS, but I think support is
    limited.

    --
    Ben.
    Ben Bacarisse, Jan 22, 2013
    #2
    1. Advertising

  3. Mr. X.

    Mr. X. Guest

    Found:
    http://saravani.wordpress.com/2012/03/14/preview-of-an-image-before-it-is-uploaded/
    That's solved my problem.

    BTW - As the above problem - how can I know also which width+height are
    related to the image?

    Thanks, anyway.

    "Ben Bacarisse" wrote in message
    news:...

    "Mr. X." <> writes:

    > Hello.
    > When I do something like this:
    > <input type="file" accept="image/*" capture ></input>
    >
    > I can attach a picture or camera on smartphones.
    >
    > This all fine,
    > but what if I want to show the picture to the user who choose it.
    > I created for that a <div> element and try to set the background-image


    Why use a background image?

    > to the file (which is on local computer or on local smarphone) -
    >
    > Then I got the path of :
    > c:/fakepath/myfile.jpg.
    >
    > How can I solve the problem?
    > The fake path - I cannot use as reference, and I don't know if I get
    > instead of the path the image source in bits (so I can do something
    > like data:image/png;base64,... a binary data ....)


    Yes, many browsers support these data pseudo-URLs in the src attribute
    of an img element. I have not used them is CSS, but I think support is
    limited.

    --
    Ben.
    Mr. X., Jan 22, 2013
    #3
    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. ©®
    Replies:
    0
    Views:
    392
  2. Erik Max Francis
    Replies:
    0
    Views:
    349
    Erik Max Francis
    Sep 27, 2003
  3. Erik Max Francis
    Replies:
    0
    Views:
    337
    Erik Max Francis
    Oct 22, 2003
  4. Sean

    Python on Smartphone 2003?

    Sean, Nov 14, 2004, in forum: Python
    Replies:
    1
    Views:
    591
  5. can javascript be faked?

    , Jan 23, 2008, in forum: Javascript
    Replies:
    3
    Views:
    113
    Saravana
    Jan 24, 2008
Loading...

Share This Page