Can iRev get the dimensions of an image?

3 messages Options
Embed this post
Permalink
Sivakatirswami

Can iRev get the dimensions of an image?

Reply Threaded More More options
Print post
Permalink
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.








_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Sarah Reichelt-2

Re: Can iRev get the dimensions of an image?

Reply Threaded More More options
Print post
Permalink
On Sun, Nov 15, 2009 at 11:11 AM, Sivakatirswami <[hidden email]> wrote:
> can the iRev engine get the dimension in width and height of an image file
> on the web server?

Here is how I do it, using ImageMagick:

-- Rev function that uses ImageMagick to get the dimensions of an image
-- returns width,height
--
function picSize pPicPath
        -- ImageMagick command: identify pic.jpg
        -- returns: pic.jpg JPEG 640x480 DirectClass 87kb 0.050u 0:01

        put "identify " & pPicPath into tCmd
        put shell(tCmd) into tSize
        put word 3 of tSize into tSize
        replace "x" with comma in tSize

        return tSize
end picSize

Cheers,
Sarah
_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution
Sivakatirswami

Re: Can iRev get the dimensions of an image?

Reply Threaded More More options
Print post
Permalink
Sarah Reichelt wrote:

> On Sun, Nov 15, 2009 at 11:11 AM, Sivakatirswami <[hidden email]> wrote:
>  
>> can the iRev engine get the dimension in width and height of an image file
>> on the web server?
>>    
>
> Here is how I do it, using ImageMagick:
>
> -- Rev function that uses ImageMagick to get the dimensions of an image
> -- returns width,height
> --
> function picSize pPicPath
> -- ImageMagick command: identify pic.jpg
> -- returns: pic.jpg JPEG 640x480 DirectClass 87kb 0.050u 0:01
>
> put "identify " & pPicPath into tCmd
> put shell(tCmd) into tSize
> put word 3 of tSize into tSize
> replace "x" with comma in tSize
>
> return tSize
> end picSize
>
> Cheers,
> Sarah
> _______________________________________________
>  

sweet -- it works here too. Thank you Sarah and all the other RunRev'ers
for being soooooo helpful!


[kt@sat image]# identify 01kanya_kumari.jpg
01kanya_kumari.jpg JPEG 480x320 480x320+0+0 8-bit DirectClass 14.6kb
[kt@sat image]#



_______________________________________________
use-revolution mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution