Can iRev get the dimensions of an image?

Sivakatirswami katir at hindu.org
Sat Nov 14 20:11:48 EST 2009


can the iRev engine get the dimension in width and height of an image 
file on the web server?

The challenge being: if you want to deliver a slide show where images 
are constrained to e.g. 700 px, but that constraint could be either by 
height or by width and you will have x number of images in landscape 
format and x number in vertical format, but you won't know in advance 
and that metadata is not stored elsewhere.... you just want to do 
something like

set the defaultFolder to 
"/home/my-domain/public_html/slideshows/amazing-images/

put the files into tFiles

repeat for each line tImage in tFiles

# now before we present anything we need to get the
# width and height here, this is fanciful code,
# but you get the idea:

get the height of image (url ("binfile:" & the defaultFolder & tImage)

If it 700 then

  ## we output a small chunk  with CSS that change the orientation of 
the area on the web page to handle a tall photo.

else

  ## we output a small chunk  with CSS that change the orientation of 
the area on the web page to handle a wide photo.

end if


We have image Magick installed, if that helps.











More information about the use-livecode mailing list