Loading image data from DB

Jeanne A. E. DeVoto revolution at jaedworks.com
Tue Apr 11 21:42:34 EDT 2006


At 10:47 AM -0600 4/7/2006, Devin Asay wrote:
>Which is essentially what I ended up doing, and it worked. Is it 
>correct to assume that 'the text' is binary data expressed as ASCII 
>text and data like 'the imageData' is "lower-level" code that can't 
>be expressed visually in a meaningful way? Forgive my naive 
>non-techie questions.

Not exactly - any binary data can be expressed in terms of ASCII (or 
extended ASCII) characters. Looking at an example:

A typical byte's worth of binary data (8 bits): 01101101
That same binary number, expressed in decimal (ordinary base-10 
numbers): 64 + 32 + 8 + 4 + 1, or 109
ASCII 109 is the character "m", so we could write that byte's worth 
of binary data as "m".

Any 8-bit segment of binary data can be expressed as a single ASCII 
character, in the same fashion, so we can always represent binary 
data as characters. The main fly in the ointment is that some of 
those characters are control characters, or characters that don't 
have a glyph to represent them, and some of those will cause real 
trouble if you try to e.g. display them in a field. (For example, the 
binary sequence "00000000" is perfectly valid and may show up in the 
binary data of any picture, but the character it's equivalent to is 
the null character, ASCII 0 - which can't be displayed on screen.)

This is the basic difference between "binary data" and "text data" - 
you can represent either one of them as either strings of ones and 
zeroes, or as sequences of ASCII characters, but text is guaranteed 
to contain only characters in the subset that can be represented in a 
text file, whereas in binary data, anything goes, and a sequence of 8 
bits might translate into any character.


>Am I correct in my understanding that these two statements are 
>functionally identical:
>
>	put myData into image "myImage"
>	set the text of image "myImage" to myData
>
>?
>
>In other words, 'put' is simply shorthand for 'set the text of <object>'?

Yes. The text property of a container object (an image, button, or 
field) is the same as a reference to that object. It works for images 
just like for fields.
-- 
jeanne a. e. devoto ~ revolution at jaedworks.com
http://www.jaedworks.com



More information about the use-livecode mailing list