Storing images

Scott Rossi scott at tactilemedia.com
Thu Feb 6 05:10:01 EST 2003


Recently, "Jim Hurley"  wrote:

>>> A more elegant or less cumbersome solution (and idiot proof for the
>>> end user) would be to embed the single images in some "secret" place
>>>  from which they might  be referenced and a different size  and
>>>  location for the image could be locked  on each card.
>> 
>> Again, a group is one solution.  Or, place all your master images into a
>> substack "library" and create images and/or buttons that reference the
>> substack.
> 
> Thank you for this suggestion. A group wouldn't work for me--the
> image is to be placed only on selective cards.

Just in case you didn't catch this, groups *can* be placed on selective
cards.  You can either manually place groups on the cards you want, or
create a series of cards with the group applied and then remove the group
from cards as needed.


> But importing from a
> substack might. How does one import the image from the subgroup to
> the main stack?

You don't need to import the image (it's already in your stack!), you simply
reference the id of the image:

  set the icon of btn display to id of img source of stack library

Or set the imageData of your target image (which effectively duplicates the
source image, as opposed to referencing it, as above):

  set the imageData of img display to \
    the imageData of img source of stack library


> And may the image then be sized on each card in the
> main stack when imported without appending a preOpenCard script?

How would you expect to resize an image without using a script?

In any event, as Björnke noted, setting the imageData of one image to
another apparently requires that the width/height of both image objects be
equal.  Then imageData can be set without issue, and the target image can be
resized as needed.

  set rect of img display to rect of img source of stack library
  set imageData of img display to imageData of img source of stack library

Bottom line is, if you need the ability to resize images, you'll need to
work with image objects, not referenced buttons.

Regards,

Scott Rossi
Creative Director
Tactile Media, Multimedia & Design
-----
E: scott at tactilemedia.com
W: http://www.tactilemedia.com




More information about the use-livecode mailing list