ImageSource with images of various sizes

Eric Chatonet eric.chatonet at sosmartsoftware.com
Fri Dec 2 13:42:02 EST 2005


Paul,

I'm sorry: I forgot a very important line in the handler I proposed:

on SetImageSource pImageName,pField,pChar, pHeight
   create invisible image
   set the botright of last image to -1,-1
   put image pImageName into last image
   set the lockloc of last image to true
   set the name of last image to pImageName & "Thumb"
   set the height of last image to pHeight
   set the width of last image to (the width of img "Ref" / the  
height of img "Ref") * pHeight
   set the imagedata of last image to the imagedata of last image
   set the imageSource of char pChar of fld pField to pImageName &  
"Thumb"
end SetImageSource

The important line to add is: set the imagedata of last image to the  
imagedata of last image
This allow to reduce the size of the"thumbnail"  image to its actual  
size: 2 KB  or less whatever can be the size of the original image :-)

Best Regards from Paris,

Eric Chatonet.

Le 2 déc. 05 à 16:12, Eric Chatonet a écrit :

> Hi Paul,
>
> Thanks for Paris :-)
>
>> If you
>> show an image of another opened stack in your button (as icon),  
>> the size
>> maybe bigger but results dropped and it's OK; in a field as  
>> imagesource,
>> it's not dropped and 'invades' the field.
>
> As far as I know, images used as icons in buttons or placed in  
> fields are never resized.
> Fortunately :-)
>
> As for me I would use something like:
>
> on SetImageSource pImageName,pField,pChar,pHeight
>   create invisible image
>   set the botright of last image to -1,-1 -- off-screen
>   put image pImageName into last image
>   set the lockloc of last image to true
>   set the name of last image to pImageName & "Thumb"
>   set the height of last image to 14
>   set the width of last image to (the width of img "Ref" / the  
> height of img "Ref") * pHeight
>   set the imageSource of char pChar of fld pField to pImageName &  
> "Thumb"
> end SetImageSource
>
> And then I would use for instance:  SetImageSource "Ref","Test",3,14
> Where Ref  is the name of an original image, Test the name of a  
> field, 3 the char number and 14 the height I want for the image in  
> the field.

----------------------------------------------------------------
So Smart Software

For institutions, companies and associations
Built-to-order applications: management, multimedia, internet, etc.
Windows, Mac OS and Linux... With the French touch

Free plugins and tutorials on my website
----------------------------------------------------------------
Web site        http://www.sosmartsoftware.com/
Email        eric.chatonet at sosmartsoftware.com/
Phone        33 (0)1 43 31 77 62
Mobile        33 (0)6 20 74 50 86
----------------------------------------------------------------




More information about the use-livecode mailing list