On Sep 30, 2004, at 3:38 AM, Igy Castrillo wrote:
Hello everyone.
This is probably an old topic -- my apologies. I've finally managed to
EncodeBase64 my JPEG, GIF & other graphic files, convert them to
strings and store them as blobs in my MySQL and RB databases.
Unfortunately, I can't figure out how to convert the Base64 decoded
binaries back to picture format so they can be displayed in my RB
front-end. The RB Language Reference & User's Guide doesn't really
help (no luck in the net either).
You could also do it this way:
1. Open the image as a Picture so that it is a standard RB Picture
object.
2. Get the Width, Height, Color Mode and other properties that you are
concerned with.
3. Use RGBSurface to loop through all of the pixels and store it in a
memoryblock.
4. Do the same for Mask.
5. Combine them into one big memoryblock in a specific order
(protocol) of your choosing.
6. Convert the Memoryblock to Base64.
7. Save in the database.
To read it out of the database, you would just reverse the process.
The disadvantage with this method is that you are not able to take
advantage of any compression (unless you added that to the image stream
as well) -- so JPG files will be much larger (especially after the
Base64 encoding).
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://www.realsoftware.com/listarchives/lists.html>
|