Status & Roadmap
Authors & License
Funding Ultimate++
Search on this site
Search in forums

SourceForge.net Logo
Home » U++ Library support » U++ SQL » Image in QLITE3 database (Load an ImgCtrl image from an SQLITE3 database)
Image in QLITE3 database [message #50237] Sat, 01 September 2018 17:32 Go to next message
raanan is currently offline  raanan
Messages: 1
Registered: September 2018
Junior Member
I can read a BLOB field that I know contains an image of some kind (probably JPEG or PNG) from an SQLITE3 database into a String, but that is afar as I can get. I did not create or populate this database (it is used by an application that I use, which works and shows these images). In fact, the images are pictures that I took with my phone, and added to the database with the application. But how do I set this String value into an ImgCtrl to show in window?

I have tried as follows.
String photo; // set with SQL select statement

And then this, which did not work.
Image img(photo);
ImgCtrl ctrl;
ctrl.SetImage(img); // crashes with no message

I tried LOG(photo), which showed a lot of binary values, including the text JFIF, so I did as follows.
FileOut out;
Sure enough, it created exactly the photo file that I expected, a JFIF file that I was able to open and view. Unfortunately, there are no examples on the web site showing how to load an ImgCtrl from such a String. An example would of course be appreciated.

[Updated on: Sun, 02 September 2018 01:23]

Report message to a moderator

Re: Image in QLITE3 database [message #50239 is a reply to message #50237] Sun, 02 September 2018 10:56 Go to previous message
mirek is currently offline  mirek
Messages: 13996
Registered: November 2005
Ultimate Member
You have to decode binary representation into Image. This example is somewhat relevant:


anyway, in this case, with String as source, use

Image img = StreamRaster::LoadStringAny(s);

Also note that by default, this will only decode .png. To add more formats, you need to add corresponding 'codecs' - plugin/jpg etc.

Previous Topic: PostgreSQL NaN fetching from DB
Next Topic: [SOLVED] How to use aliases with SqlExp?
Goto Forum:

Current Time: Tue Jul 23 14:41:18 CEST 2024

Total time taken to generate the page: 0.03797 seconds