Click here to Skip to main content
13,003,102 members (58,635 online)
Rate this:
Please Sign up or sign in to vote.
See more:
How to save this blob data into database?? I am reading the jpeg image in Qbytearray; But while saving to database, the image size is doubled and while retrieving from database, the file is being corrupted. How to read the image properly??

QByteArray buf=NULL;
originalPixmap =QPixmap();
originalPixmap = QPixmap::grabWindow(QApplication::desktop()->winId());
QString strfname;
strfname.sprintf("%d",c);"C:\\Program Files\\image"+strfname+".jpeg","jpeg");
char Data;
QFile file("C:\\Program Files\\image"+strfname+".jpeg");;
int len=file.size();
QSqlQuery query;
query.exec("INSERT INTO log (grab_date, ip_address, image,logged_user) "
"VALUES (?,?,?,?)");
query.bindValue (3,hostname);
bool qry=query.exec();
Posted 5-Aug-11 0:25am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You are converting the image to base64. You must either remove the conversion or convert it back at the other end.
Gokulnath007 5-Aug-11 8:46am
Couldnt get your point?? Could you please explain with my code??
Gokulnath007 5-Aug-11 8:47am
I have tried in removing the conversion of to base64 also, again the same thing happens.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170626.1 | Last Updated 5 Aug 2011
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100