PDA

View Full Version : Save Image in XML file



neda
5th March 2016, 10:48
Hi,
I want to get image from camera and save to XML file.
I pass "photoPreview.source (== image://camera/preview_1)" as URL of captured image to c++ class.
I have this error:
"Open error"

I use this code for save image in XML file:


QFile fileImg(url_image); // == > photoPreview.source (== image://camera/preview_1)
fileImg.open(QIODevice::ReadOnly);
QByteArray imageData = fileImg.readAll();
QByteArray imageData_Base64 = imageData.toBase64();
xmlWriter.writeAttribute("image",imageData_Base64);

anda_skoa
5th March 2016, 11:14
url_image is an URL, not a name of a file on disk. QFile works with those.

Cheers,
_

neda
5th March 2016, 11:21
Thank you,
Yes I know, but How can I get URL of captured image by camera? (URL of photoPreview.source)

anda_skoa
5th March 2016, 12:23
What type is photoPreview?

Cheers,
_

neda
6th March 2016, 06:01
Thank you.
I used the capturedImagePath to get the file corresponding to my captured image.
My problem is solved.