Decode in livecode
Moderators: FourthWorld, heatherlaine, Klaus, robinmiller
-
- Posts: 17
- Joined: Sat Aug 10, 2013 3:23 pm
Decode in livecode
I have images in my database. How do i extract them & view them on livecode itself ?I believe i need to decode the string, anyone knows whats the code to decode
Re: Decode in livecode
Hi Babyprincess (Really? C'mon
)
1. welcome to the forum!
2. It depends on how the strings are ENCODED!
Any idea how? And are that really "strings"?
Best
Klaus
![Very Happy :-D](./images/smilies/icon_biggrin.gif)
1. welcome to the forum!
2. It depends on how the strings are ENCODED!
Any idea how? And are that really "strings"?
Best
Klaus
-
- Posts: 17
- Joined: Sat Aug 10, 2013 3:23 pm
Re: Decode in livecode
Thank you very much. I actually copied the "strings" into some online decoder (base64) & it did decode & output the image. All my image data are in my database, however i can't see the thumbnail view of them, that's why i believe i am supposed to decode it ): Please help me.
Re: Decode in livecode
Ah, OK, that helps ![Smile :-)](./images/smilies/icon_smile.gif)
Do this to display the db output (I use the variable db_image_output in my example) into an image object (dbimage)
...
## fetch your "image string" from the database, put it into a variable,
## decode that variable and simply "put" it into an existing image object:
put base64decode(db_image_output) into img "dbimage"
...
Best
Klaus
![Smile :-)](./images/smilies/icon_smile.gif)
Do this to display the db output (I use the variable db_image_output in my example) into an image object (dbimage)
...
## fetch your "image string" from the database, put it into a variable,
## decode that variable and simply "put" it into an existing image object:
put base64decode(db_image_output) into img "dbimage"
...
Best
Klaus
-
- Posts: 17
- Joined: Sat Aug 10, 2013 3:23 pm
Re: Decode in livecode
Hi Klaus,
Thank you so much for your help (:
I tried doing this, am i on the right track? But i got an error [(Chunk: no such object) near "dbimage", char 26] ):
When i named my 'Image Area' as dbimage, i don't have any error but there is no output of any images
on mouseUp
put media_name into columnName
put "data" into CN2
put base64decode(CN2) into img "dbimage"
put "SELECT messages." & columnName & ",messages." & CN2 & " FROM messages WHERE messages." &columnName& "= messages." &columnName&"" into sql
put databaseGetData(sql) into ptext
set the dgText of group "Table" to ptext
end mouseUp
sincerly,
Babyprincess (:
Thank you so much for your help (:
I tried doing this, am i on the right track? But i got an error [(Chunk: no such object) near "dbimage", char 26] ):
When i named my 'Image Area' as dbimage, i don't have any error but there is no output of any images
on mouseUp
put media_name into columnName
put "data" into CN2
put base64decode(CN2) into img "dbimage"
put "SELECT messages." & columnName & ",messages." & CN2 & " FROM messages WHERE messages." &columnName& "= messages." &columnName&"" into sql
put databaseGetData(sql) into ptext
set the dgText of group "Table" to ptext
end mouseUp
sincerly,
Babyprincess (:
Re: Decode in livecode
Hi Babyprincess,
please check these stacks to get the basics of Livecode:
http://www.hyperactivesw.com/revscriptc ... ences.html
![Cool 8-)](./images/smilies/icon_cool.gif)
Although it may seem to some people that programming is some kind of witchcraft, I can assure you that this is not the case!![Very Happy :-D](./images/smilies/icon_biggrin.gif)
Of course you need to get the correct "image-string" form your database and then base64decode and use THAT string:
...
## HINT: This is an example and you may need to modify the herein used object names to fit your script!
put "SELECT your_image from your_table WHERE XXX = YYY" into tSQL
## I think "databaseGetData" is a custom function?
## whatever, I hope you get the picture!
put databaseGetData(tSql) into pImage
put base64decode(pImage) into img "Image Area"
...
Best
Klaus
please check these stacks to get the basics of Livecode:
http://www.hyperactivesw.com/revscriptc ... ences.html
Sigh, I did not think that it is neccessary to note that the object names in my EXAMPLE script may not fit YOUR actual object names! Is it?Babyprincess wrote:...
I tried doing this, am i on the right track? But i got an error [(Chunk: no such object) near "dbimage", char 26] ):
When i named my 'Image Area' as dbimage, i don't have any error ...
![Cool 8-)](./images/smilies/icon_cool.gif)
Do you really exspect that the TEXT "data" will turn into an IMAGE after you base64decode it?Babyprincess wrote:... but there is no output of any images
...
put "data" into CN2
put base64decode(CN2) into img "dbimage"
...
Although it may seem to some people that programming is some kind of witchcraft, I can assure you that this is not the case!
![Very Happy :-D](./images/smilies/icon_biggrin.gif)
Of course you need to get the correct "image-string" form your database and then base64decode and use THAT string:
...
## HINT: This is an example and you may need to modify the herein used object names to fit your script!
put "SELECT your_image from your_table WHERE XXX = YYY" into tSQL
## I think "databaseGetData" is a custom function?
## whatever, I hope you get the picture!
put databaseGetData(tSql) into pImage
put base64decode(pImage) into img "Image Area"
...
Best
Klaus
-
- Posts: 17
- Joined: Sat Aug 10, 2013 3:23 pm
Re: Decode in livecode [Complete Beginner]
Hi Klaus,
I'm sorry but i'm quire confused. This is the first time i'm coding in livecode that's why.
I tried what you said but then i kept getting various errors & my original output did not appear, so i alter'd the code again to this,i got 2 outputs extracted. It just appeared on my dektop with the image name. But i was unable to view it. Haiz,it's still not working. I'm kinda noob in live-code. Please help me. Sorry ):
on mouseUp
put media_name into columnName
put "data" into CN2
put media_wa_name into CN3
put "SELECT messages." & columnName & ",messages." & CN2 & " FROM messages WHERE messages." &columnName& "= messages." &columnName&"" into sql
put databaseGetData(sql) into ptext
set the dgText of group "Table" to ptext
put databaseGetData(sql) into pImage
put base64decode(pImage) into img "Image Area"
end mouseUp
A little background on what i'm doing- I'm doing a project on Whatsapp forensics. So i have to extract the images from the database & display in a thumbnail format. I've managed to actually been able to decrypt n display all the other informations. But i'm stuck at the images part.
I'm sorry but i'm quire confused. This is the first time i'm coding in livecode that's why.
I tried what you said but then i kept getting various errors & my original output did not appear, so i alter'd the code again to this,i got 2 outputs extracted. It just appeared on my dektop with the image name. But i was unable to view it. Haiz,it's still not working. I'm kinda noob in live-code. Please help me. Sorry ):
on mouseUp
put media_name into columnName
put "data" into CN2
put media_wa_name into CN3
put "SELECT messages." & columnName & ",messages." & CN2 & " FROM messages WHERE messages." &columnName& "= messages." &columnName&"" into sql
put databaseGetData(sql) into ptext
set the dgText of group "Table" to ptext
put databaseGetData(sql) into pImage
put base64decode(pImage) into img "Image Area"
end mouseUp
A little background on what i'm doing- I'm doing a project on Whatsapp forensics. So i have to extract the images from the database & display in a thumbnail format. I've managed to actually been able to decrypt n display all the other informations. But i'm stuck at the images part.
-
- Posts: 17
- Joined: Sat Aug 10, 2013 3:23 pm
Re: Decode in livecode
This is how i display'd all the other information from my whatsapp decrypted database
on mouseUp
ask "Table name" #messages-for my reference i included this
put it into table
put databaseGetTableNames(table) into theFields
replace "," with CR in theFields
set the dgProp["columns"] of group "DataGrid 2" to theFields
ask "SQL Statement" #SELECT*FROM messages-for my reference i included this
put it into sql
put databaseGetData(sql) into ptext
set the dgText of group "DataGrid 2" to ptext
end mouseUp
When i run this, all my whatsapp conversation informations are displayed. But...
- For contents with images, the "thumbnail" column does not show the thumbnail of the image but it does have a weird sign there which i believe indicates the presence of a image under that column
on mouseUp
ask "Table name" #messages-for my reference i included this
put it into table
put databaseGetTableNames(table) into theFields
replace "," with CR in theFields
set the dgProp["columns"] of group "DataGrid 2" to theFields
ask "SQL Statement" #SELECT*FROM messages-for my reference i included this
put it into sql
put databaseGetData(sql) into ptext
set the dgText of group "DataGrid 2" to ptext
end mouseUp
When i run this, all my whatsapp conversation informations are displayed. But...
- For contents with images, the "thumbnail" column does not show the thumbnail of the image but it does have a weird sign there which i believe indicates the presence of a image under that column
-
- Posts: 17
- Joined: Sat Aug 10, 2013 3:23 pm
Re: Decode in livecode
Hi Klaus,
Thank you so much for your help and guides. I've finally managed to output my images. Thank you so much.
The error i kept having was my naming conventions. After i check'd my naming conventions thoroughly, i managed to see where i went wrong.
Thank you once again for your genuine help.
Sincerely,
Babyprincess (ME) (:
Thank you so much for your help and guides. I've finally managed to output my images. Thank you so much.
The error i kept having was my naming conventions. After i check'd my naming conventions thoroughly, i managed to see where i went wrong.
Thank you once again for your genuine help.
Sincerely,
Babyprincess (ME) (:
Re: Decode in livecode
Hi Babyprincess,
glad you got it working!
"Haiz"? Are you from Singapur?![Smile :-)](./images/smilies/icon_smile.gif)
Best
Klaus
glad you got it working!
"Haiz"? Are you from Singapur?
![Smile :-)](./images/smilies/icon_smile.gif)
Best
Klaus
Re: Decode in livecode
![Smile :-)](./images/smilies/icon_smile.gif)
Your message contains 3 characters. The minimum number of characters you need to enter is 10.