Image resize.

Frank D. Engel, Jr. fde101 at fjrhome.net
Tue Oct 19 16:35:15 EDT 2004


Apparently I missed a message here: I didn't get the one with the full  
code.

If anyone knows how to get the original size of an image, we could  
simply handle the resizeControl method and check to see if a key is  
being held down down (maybe controlKey or shiftKey) and adjust the  
height/width accordingly.

Something like this:

on resizeControl
   if the first word of the abbreviated name of the target is "image"  
and the shiftKey is down then
     put the height of the target into curhigh
     put the width of the target into curwide
     put the <original height> of the target into orighigh
     put the <original width> 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

Obviously, we could simply record the original width/height before  
resizing, and this could be used to maintain the aspect "as is" during  
the resize, but I would personally prefer to maintain the original  
aspect ratio recorded in the image file.  Is it possible to get that  
info from rev (the actual pixel width and height recorded in an image)?

On Oct 19, 2004, at 4:20 PM, Klaus Major wrote:

> Hi Derek,
>
>>> This bugs me too.  Is anyone aware of a simple Transcript workaround
>>> (to constrain the size during resize using a script), or should I  
>>> start
>>> trying to be clever here?
>
>> This should help...
>>
>> global  
>> oWidth,oHeight,newWidthPixels,newWidthPercent,newHeightPixels,newHeigh 
>> tPercent
>>
>> --  For the Width
>>
>> on doUpdate
>> put (word 2 of the selectedLine of btn "widthUnit") into widthUnit
>> ...
>
> very nice, Derek, very nice!
>
> Could you eventually consider to give a TINY hint on how to use it?
>
> Thanks ;-)
>
>
> Best
>
> Klaus Major
> klaus at major-k.de
> http://www.major-k.de
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
>
-----------------------------------------------------------
Frank D. Engel, Jr.  <fde101 at fjrhome.net>

$ ln -s /usr/share/kjvbible /usr/manual
$ true | cat /usr/manual | grep "John 3:16"
John 3:16 For God so loved the world, that he gave his only begotten  
Son, that whosoever believeth in him should not perish, but have  
everlasting life.
$



___________________________________________________________
$0 Web Hosting with up to 120MB web space, 1000 MB Transfer
10 Personalized POP and Web E-mail Accounts, and much more.
Signup at www.doteasy.com



More information about the use-livecode mailing list