Long version:
Hi, I’d like to take pictures from the built in camera. I am aware of the getUserMedia Example, but it’s not working on iOS <11 and it’s not what I want. I really would like to start the camera app with all it’s functionality and not just take a snapshot of the videostream.
Also I could do it with the PhoneGap Camera Plugin, but I dont want to wrap the webapp into a native app with phonegap.
' This sample lets you get a picture from the camera or the Photo Library
rotation = 0
Function btnMail_onclick()
location = "mailto:" & encodeURI("myaddress@yahoo.com") & "?subject=" & encodeURI("My Great Photo") & "&body=" + "<img src='" & PictureBox1.toDataURL() & "'/>"
End Function
Function btnRotate.onclick()
Dim pb
rotation = (rotation + 90) % 360
If ((rotation % 180) != 0) Then 'portrait
PictureBox1.resize(48, 100, 225, 300)
Else 'landscape
PictureBox1.resize(10, 128, 300, 225)
End If
pb = PictureBox1.getContext("2d")
pb.save()
pb.translate(PictureBox1.width / 2, PictureBox1.height / 2)
pb.rotate(rotation * Math.PI / 180)
imgObj = PictureBox1.img
NSB.drawImageIOSFix(pb, imgObj, 0, 0, 0, 0, -150, -112, 300, 225)
pb.restore()
End Function
Then I get only the resolution of the picturebox, not of the actual image! How to resolve the full resolution of the image and save that jpg to server? Do I need to go the way I described above?
In the attached project I have a Camera control, PictureBox, Button and TextArea.
I take a picture with the camera. I put it into PitureBox1. then I’ll convert it to b64 with
TextArea1.text = PictureBox1.toDataURL()
If I decode the string at https://www.base64decode.org/ (without the start: data:image/png;base64,)
I’ll get a png that has exactly the same dimensions as my Picturebox 198x268.
That makes sense because I convert the picturebox - not the taken picture.So the question is: how to grap the full taken picture as a file?
Yes. i did that with ajax. working. but the image dimensions are small. they have the same dimensions as the picturebox!
Well, I’ve send the pic to the server by ajax in data url format, I did not yet implement that the php decode the b64 before saving it as a file. but nevertheless…
the file that is stored on the server IS TOO SMALL. it has only the exact size of the picturebox - even though I set width and height to auto. but that didn’t help
that’s why I’ve upload an example project that gives the b64 out directly without sending to server first as that is easier to test.
The uploaded pictures in project one will always have the size of the picturebox1.
In second project the uploaded picture dimensions equals the captured/choosen file dimensions.
I think it is neccecary to add the functionality to the Camera1 object to retrieve the full size of captured images in order to avoid difficult approach 2
ahah, sure
i want to click on a picture and open a picker to change just that picture on which i clicked without using plugings.
Right now I found what was the problem using another picture (in any format): the reason was that the program was trying to load that picture from the assets instead I had just put cam.jpg in the same folder of cam.png and of course it was not enough.
Sorry