Crossplatform Vblob jpeg storage

Chuck rwc1717 at shaw.ca
Thu Jun 12 18:54:57 CDT 2003


Tested and working....windows and mac and no QuickTime needed.

	After dragging and dropping a jpeg using either of MonkeyBread 
JPEGImporter class or after extracting the binary stream (ie:openasbinaryfile) and 
using JPEGPictureToString(string,true)...both these examples are included with 
MonkeyBread Plugin........onto a canvas.

Save to a Blob field:

dim p as Picture
dim s as String

p = canavs1.backdrop
s = JPEGPictureToString(p,100)   // highest quality...0 being the lowest

tDb.mA.jpgblob.writeRawData(s)
tDb.mA.AddRecord
tDb.mA.Flush


Loading from the database Blob field:

dim p as Picture
dim s as String
dim rs as VCursor
dim res as Boolean

rs = Nil
rs = tDb.SQLSelect("select * from picts")
res = tDb.mA.FirstRecord
s = tDb.mA.jpgblob.readRawData
p = JPEGStringToPicture(s,true)  //true allows damaged pictures to be used
tDb.Flush
canavs2.backdrop

**same code should work storing mpeg string and using OpenMoviefromString from 
MBS**

Thanks for the help Ruslan.






More information about the Valentina mailing list