On Thu Aug 31, 2006, paolo mazza paolo.mazza at neol.it wrote:

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

>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



Getting the "text" of an image and then later setting the imagedata to that text indeed results in very much distorted images. What is probably needed here would be property like he "formattedtext of image x". When you compare the number of chars of the "text" of the image and the number of chars of the imagedata you see that a lot of chars is missing in the text.-

I used the scripts below in an experimental stack, which worked fine with most pictures (that is, with very few pictures some lines are missing at the bottom of the image, but otherwise the image is undistorted - the reason for the missing lines escapes me).

A. Converting the imagedata to text:

"on mouseUp
   put the imageData of image x into iData
   put empty into imagetext
  repeat for each char c in idata
   put chartonum(C) into tc
   put numtochar(tC) after imagetext
 end repeat
 put imagetext into fld "imagetext"
end mouseUp"

B. Setting the imagedata from the text:

"on mouseUp
   put the imageData of image x into iData
 put 0 into counter
 put fld "imagetext" into tText
 repeat for each char C in tText
   add 1 to counter
   put chartonum(char counter of tText) into tC
   put numtochar(tC) into char counter of idata
 end repeat
 set the imageData of image x to iData
 end mouseUp"

The important thing here is to first get the imagedata of the image in which you want to display the stored imagetext data.
If you use - as a variation of the second script -

"put empty into idata" and " put numtochar(tC) after idata" in the above script

you will get a picture, but also a very distorted one.


Regards,

Wilhelm Sanke
<http://www.sanke.org/MetaMedia>


_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to