Image resize.

Ryno Swart swartart at iafrica.com
Fri Oct 22 04:48:27 EDT 2004


Thanks to all of you for your help with resizing an image.

This one, from Frank, works beautifully, but as far as I can see, only 
in Rev 1.1.1. (I had to change an "and" to a "then", so the version 
below includes my little edit.) Maybe you could make it work in newer 
versions using another key combination and post that?

If the following is placed in the stack script, clicking and dragging 
on the resize handles retain the proportions of the image.

This script is very valuable to me.

Thanks, Frank!

> on resizeControl
>    if the first word of the abbreviated name of the target is "image"
> then if the optionKey is down
> then
>      put the height of the target into curhigh
>      put the width of the target into curwide
>      put the formattedHeight of the target into orighigh
>      put the formattedWidth of the target into origwide
>
>      put origwide/orighigh into aspect1
>      put orighigh/origwide into aspect2
>
>      multiply aspect1 by curhigh
>      multiply aspect2 by curwide
>
>      if aspect1 > curwide then
>        set the height of the target to aspect2
>      else if aspect2 > curhigh then
>        set the width of the target to aspect1
>      end if
>    end if
> end resizeControl



More information about the use-livecode mailing list