encode text to image
paolo mazza
paolo.mazza at neol.it
Thu Aug 31 03:47:24 EDT 2006
Thank you Dar .
I have to store an image in a MySQL database and I was told I could store
the text... it is not gonna work ... I thought it was like that.... but I
wanted be sure that there was not a way to recover the imagedata from the
text.
So, I have to encode and decode the image data ... I tryed this way, but
unfortunately , when I decode image data and upload it in in the database,
some chars get lost.
Ciao Paolo
>
>
>> I imported an image as text (URL file:xxx)
>> I wonder if I can convert the text file to binary and set the
>> imagedata of
>> an image to it
>
>If the image file format is inherently binary, such as PNG or JPEG,
>then you should read it as a binary file (URL binfile:). Reading a
>binary file as a text file will corrupt it.
>
>
>If it is really text, then it probably has some header information
>that includes the size, and then a bunch of numerals in decimal or
>hex. You need to know what its format is.
>
> From that, you can build imageData. If the file has an alpha
>channel (transparency) you can also build alphaData.
>
>
>After you have the image data, set the text of the image to empty
>then set the height and width of the image, then set the imageData
>(and alphaData). (I'm going by memory; there might be a flaw in that.)
>
>If the image file is really JPEG or PNG then simply set the text of
>the image to the value.
>
>Dar Scott
********************************************************
Paolo Mazza
NEOL SRL
Via Calatafimi, 16 - 35137 PADOVA
www.neol.it paolo.mazza at neol.it
Tel 049-7386590
More information about the use-livecode
mailing list