Page 1 of 1

Images in databases

Posted: Sun Sep 08, 2019 9:25 pm
by dpalmersce@gmail.com
What is the best way to get an image converted to binary in order to store it in a database. I tried taking and getting the image data of an image and then converting it to binary but it got really slow and I know it shouldn't be doing that. I'm using livecode 9 on a Mac with a SQL database. To convert the image data 2 binary I was using binary decode thanks for any help

Re: Images in databases

Posted: Mon Sep 09, 2019 3:41 pm
by jacque
Images are already binary, they don't need conversion.

Re: Images in databases

Posted: Mon Sep 09, 2019 4:46 pm
by dpalmersce@gmail.com
I do understand that they are binary but when I try to store them in a variable to send to my database it won't send it and when I look at what is being sent on message it just puts the number 1. So what would be the best way to do this?

Re: Images in databases

Posted: Tue Sep 10, 2019 4:31 pm
by jacque
I'm not the right person to ask about database interactions but I'm pretty sure this has been discussed here in the past. Did you try searching the forums for "images in databases" or variations of that? I seem to remember the word "blob" is involved.

I do so little work with databases but lots of others here do.

Re: Images in databases

Posted: Tue Sep 10, 2019 4:49 pm
by bogs
Well, I know it is a popular topic not just here, but all over. And I used to put images in dbs myself, but I've started not doing that recently. A fairly good discussion on it can be found here.

However, assuming you have your heart set on doing this, I believe the general consensus is to either use the text of the image, or encode / decode the image (base64). There are several threads you can look at, as I say, it has come up a lot. There are also lessons about images and databases. Here are a few of the links I've come across:
http://lessons.livecode.com/m/4071/l/26 ... a-database
https://forums.livecode.com/viewtopic.php?t=25064
https://forums.livecode.com/viewtopic.php?t=488

Re: Images in databases

Posted: Mon Sep 30, 2019 1:48 pm
by dpalmersce@gmail.com
Thank you, everyone for all your help!