How do I import and set images based upon their width and height?
m.schonewille at economy-x-talk.com
Wed Jan 28 04:15:33 CST 2009
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
put theCdHeight / theImgHeight into myRatio
put theImgWidth * myRatio into myNewWidth
put theImgHeight * myRatio into myNewHeight
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
Economy-x-Talk Consulting and Software Engineering
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
> William (from a very cold Holland)
More information about the use-livecode