Storing images

J. Landman Gay jacque at hyperactivesw.com
Tue Feb 4 16:21:01 EST 2003


Judy Perry <jperryl at ecs.fullerton.edu> wrote:
> Perhaps my gripe stems (as usual) from a lack of understanding.  I've
> tried something like this -- importing as a control some image.  But I
> didn't want it on the card where I imported it (not thinking about where I
> was; okay, it wasn't really me it was a student) and so I clicked on it
> and hit the delete key.  On the same card, I tried "show image imageName"
> and got nothing.  Now, if I recall correctly in HC, you can delete it on
> the card (or funny color draw) layer but the image is still there in the
> stack, waiting for you to show it again whenever you wish.
> 
> Am I wrong?  It's always sooo nice to be wrong about such things!

<smile> No, you aren't wrong. When you deleted the original imported 
image, you removed the image data. To compare to HC, that would be the 
equivalent of deleting an image from the resource fork. Whether it is 
the data fork or the resource fork, you've got to have an original 
somewhere for the engine to make copies of. Some of the confusion may be 
because resource forks are usually invisible, so the process of storing 
an image there isn't as obvious. But when you import an image into Rev, 
the object that appears on the card is the actual image data, not a copy 
of one stored elsewhere. The image you see on the card is exactly 
equivalent to the image data that HC stores in the resource fork. It's 
the original copy.

There are a couple of ways to deal with what happened. If you only need 
to display the image once in the stack, then just select the 
mis-imported image, cut, go to the card where it should have been 
imported, and paste it. If instead you want to use the image as the 
source for multiple copies: note its ID number and then, if you want to, 
hide the image. Wherever you want a copy displayed, make a button and 
set the button's icon to the ID of the image.

The general idea is: you need a source image no matter what. In HC, the 
source is stored in the resource fork where you can't see it. In Rev, 
the source is stored in the data fork where you *can* see it as an 
actual object on a card. Once a source image is available, both Rev and 
HC can display multiple copies of it; HC by using addcolor calls, Rev by 
using icon IDs.

All this applies only if you want to embed the images within the stack 
file. Others have posted about the advantages of reading the image from 
disk, which is another option. Depends on what you need to do, and how 
large the images are.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com




More information about the use-livecode mailing list