How do I import and set images based upon their width and height?

William de Smet williamdesmet at gmail.com
Wed Jan 28 05:22:18 EST 2009


Hi Terry and Mark,
Thanks for your replies.
I will give it a try later today.
Mark I will start using the Dutch forum more often and it is less cold than
some time ago but when bringing my son to school this morning at 08.15 my
hands were freezing off :-)

Greetings!

2009/1/28 Mark Schonewille <m.schonewille at economy-x-talk.com>

> Hi William,
>
> I used this to adjust images to the card size:
>
> function rescale theImgWidth,theImgHeight,theCdWidth,theCdHeight
>  if theCdWidth/theImgWidth < theCdHeight/theImgHeight then
>    put theCdWidth / theImgWidth into myRatio
>  else
>    put theCdHeight / theImgHeight into myRatio
>  end if
>  put theImgWidth * myRatio into myNewWidth
>  put theImgHeight * myRatio into myNewHeight
>  return myNewWidth,myNewHeight
> end rescale
>
> The parameters theImgWidth and theImgHeight are the formattedWidth and
> formattedHeight of your image object and theCdWidth and theCdHeight are the
> width and height of the destination area. The function returns the new width
> and height for your image object.
>
> I didn't think it is that cold here. It is almost 20 degrees warmer than
> some time ago. Btw maybe you should have asked in the Dutch forum... ;-)
>
> --
> Best regards,
>
> Mark Schonewille
>
> Economy-x-Talk Consulting and Software Engineering
> http://economy-x-talk.com
> http://www.salery.biz
> Dutch forum: http://runrev.info/rrforum
>
> We are always looking for new projects! Feel free to contact us to discuss
> your custom software project!
>
>
> On 28 jan 2009, at 11:07, William de Smet wrote:
>
>  Hi there,
>> I am trying to import images and put them into their own 'dummyimage'
>>  based
>> upon their width and height.
>> The 'dummyimages' are called Photo and Photo2.
>> It doesn't work!
>> Can someone help me with this one?
>>
>> *on* mouseUp
>>
>>  *put* empty into img "Photo"
>>
>>  *put* empty into img "Photo2"
>>
>>  *answer* file "Choose a photo:"
>>
>>  *if* it = empty
>>
>>  *then* *exit* mouseUp
>>
>>  *put* url ("binfile:" & it) into tPhoto
>>
>>  *put* the width of the last image into tWidth
>>
>>  *put* the height of the last image into tHeight
>>
>>  *if* tWidth <= tHeight
>>
>>  *then* *put* tPhoto into img "Photo2"
>>
>>  *if* tWidth >= tHeight
>>
>>  *then* *put* tPhoto into img "Photo"
>> *end* mouseUp
>>
>> Thanks!
>>
>> Greetings,
>>
>> William (from a very cold Holland)
>>
>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>



More information about the use-livecode mailing list