Retrieve images from mySql

Creating desktop or client-server database solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
steve_nam
Posts: 60
Joined: Wed Jan 08, 2014 1:09 pm

Retrieve images from mySql

Post by steve_nam »

I have spent a big chumk of my days reading this forum, stackoverflow and any LiveCode resource I could find, but I am still unable to solve my challenge (namely the fact that I am not quite up to standard with LiveCode, but I am definitely getting there).

The only solution is to ask the Gurus in the Forum.

Anyone willing to help me retrieving an image from a mySql database?

Here is my situation.
I can query the database successfully. My query displays all requested data exactly as I wanted.

set the ItemDel to tab
put item 1 of tRecord && item 2 of tRecord into field "surname"
put item 3 of tRecord into field "IDpassport"
put item 4 of tRecord into field "citizenship"

when I want to put item 5 of tRecord into field "photo" I get an error (no such object) near "photo"

Anyone interested to assist and teach me the correct and proper way.

Cheers
Steve
Klaus
Posts: 14324
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Retrieve images from mySql

Post by Klaus »

Hi Steve,

I hardly dare to ask, but do you really have a FIELD named "photo" or is it maybe an IMAGE? 8)

Anyway, how are the image data in the database encoded, if at all?
This is what we need to know.


Best

Klaus
steve_nam
Posts: 60
Joined: Wed Jan 08, 2014 1:09 pm

Re: Retrieve images from mySql

Post by steve_nam »

Klaus,
You are so kind and helpful in the Forum....always willing to assist. Thanks a million (from me and all other rookie LiveCoders).

Well you're right. It is an image. When I write "put item 5 of tRecord into image "photo""the error (no such object) near "photo" does not exits anymore. But still no photo makes its appearance.

Your next question: "how are the image data in the database encoded, if at all?" Tricky one to answer. How do I find out if the image data is encoded or not? The image is stored as a "blob" .

Regards,
Steve
Klaus
Posts: 14324
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Retrieve images from mySql

Post by Klaus »

Hi Steve,

OK, try:
...
set the text of img "photo" to item 5 of tRecord
...

But since BLOB means BINARY, I'm not sure if this will work at all with the CR and TAB delimiter in your data!?
Binary stuff is still a mistery to me, but maybe this binary data are MULTILINE, then this will not work, know what I mean?


Best

Klaus
bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 937
Joined: Fri Aug 15, 2008 7:15 am

Re: Retrieve images from mySql

Post by bangkok »

steve_nam
Posts: 60
Joined: Wed Jan 08, 2014 1:09 pm

Re: Retrieve images from mySql

Post by steve_nam »

Klaus
Thanks a million for your assistance. I will post the outcome of everything in the forum.

Bangkok, I will browse the links you posted.

Thanks you Gurus
Steve
steve_nam
Posts: 60
Joined: Wed Jan 08, 2014 1:09 pm

Re: Retrieve images from mySql

Post by steve_nam »

Hi, check out the Lesson created to sort this challenge out. http://lessons.runrev.com/m/4071/l/2633 ... a-database
It will certainly help a lot of LiveCoders.

Enjoy
Steve
Post Reply