Shrinking an image to a button icon
J. Landman Gay
jacque at hyperactivesw.com
Sun Dec 21 21:52:54 EST 2003
On 12/21/03 7:49 PM, Jim Carwardine wrote:
> Does anyone have scripting to take an image selected by the user, shrink it
> to a thumbnail and place it as an icon on a button? When the button is
> clicked, I¹d like to show the picture snapshot size... Jim
In the script of the display button:
on mouseUp
answer file "Choose image:"
if it = "" then exit mouseup
put it into theImgPath
put 75 into theTargetSize -- adjust size here
create image
hide last img -- you may want to change this
set the filename of last img to theImgPath
put theTargetSize/the formattedwidth of last img into theRatio
set the width of last img to theTargetSize
set the height of last img to \
round(the formattedheight of last img * theRatio)
set the icon of me to the short id of last img -- or set a different btn
choose browse tool
end mouseUp
--
Jacqueline Landman Gay | jacque at hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
More information about the use-livecode
mailing list