Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   HTML (http://www.velocityreviews.com/forums/f31-html.html)
-   -   Faked path - Smartphone. (http://www.velocityreviews.com/forums/t956803-faked-path-smartphone.html)

Mr. X. 01-22-2013 08:05 PM

Faked path - Smartphone.
 
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 :)


Ben Bacarisse 01-22-2013 08:50 PM

Re: Faked path - Smartphone.
 
"Mr. X." <nospam.mrx@gmail.com> 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. 01-22-2013 10:49 PM

Re: Faked path - Smartphone.
 
Found:
http://saravani.wordpress.com/2012/0...t-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:0.9eb5b06b2d846a60dad8.20130122205013GMT.87vc ap3ptm.fsf@bsb.me.uk...

"Mr. X." <nospam.mrx@gmail.com> 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.



All times are GMT. The time now is 09:54 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.