Having this VBScript function:
[syntax=vb]Const adTypeBinary = 1
Dim oStream, bData
Set oStream = CreateObject("ADODB.Stream")
oStream.Type = adTypeBinary
oStream.Open
oStream.LoadFromFile "D:\temp.jpg"
bData = oStream.Read[/syntax]
How can I get the binary data on a Neobook variable?
Regards
Get binary data from image
Moderator: Neosoft Support
Re: Get binary data from image
Stu:
How about doing a "base64 encoding" of the binary data ... and then reading/storing the resulting "text string" in a NeoBook variable ?
How about doing a "base64 encoding" of the binary data ... and then reading/storing the resulting "text string" in a NeoBook variable ?
Re: Get binary data from image
Might just do the trick... Need a plugin for that?Gaev wrote:Stu:
How about doing a "base64 encoding" of the binary data ... and then reading/storing the resulting "text string" in a NeoBook variable ?
That method is not working for me btw (the op one)... It gives a crappyfied string thats no use to me... I'm looking for this sort of result:
0x443A5C46455C437573746F647944617461626173655C74656D702E6A7067
Re: Get binary data from image
Not sure what you want to do with the data, but maybe this might help:
Action: hpwImageSaveToMimeStream - Save a image to MimeStream (BMP/JPG/PNG/CAR).
First you have to load it to the image of course.
Regards
Action: hpwImageSaveToMimeStream - Save a image to MimeStream (BMP/JPG/PNG/CAR).
First you have to load it to the image of course.
Regards
Hans-Peter
Re: Get binary data from image
I dont store images in databases but as a requirement I need to store some small > 10 Kb jpg's on an SQL database (MS SQL 2005), so I'm trying to do this:
[syntax=sql]INSERT INTO Files (FileId, FileData) VALUES (1, 0x010203040506)[/syntax]
since thats the format images get stored on the SQL database field IMAGE, I dont know how can I turn an image into that sort of binary string, really... thats the issue.
-----
And, actually, this approach suits me:
[syntax=sql]UPDATE tblRights SET Sig1 = (SELECT * FROM OPENROWSET(BULK N'D:\Temp\temp.jpg', SINGLE_BLOB) AS x) WHERE RightsID = 9[/syntax]
Except that for some reason I keep getting "data set closed" sort of error from Neobook, maybe I should keep trying, but thought it might be possible to go the other way...
[syntax=sql]INSERT INTO Files (FileId, FileData) VALUES (1, 0x010203040506)[/syntax]
since thats the format images get stored on the SQL database field IMAGE, I dont know how can I turn an image into that sort of binary string, really... thats the issue.
-----
And, actually, this approach suits me:
[syntax=sql]UPDATE tblRights SET Sig1 = (SELECT * FROM OPENROWSET(BULK N'D:\Temp\temp.jpg', SINGLE_BLOB) AS x) WHERE RightsID = 9[/syntax]
Except that for some reason I keep getting "data set closed" sort of error from Neobook, maybe I should keep trying, but thought it might be possible to go the other way...