Sweet!  Never noticed 'imagesize'.  Thanks!

On Tue, Jul 1, 2008 at 4:02 PM, _why <[EMAIL PROTECTED]> wrote:
> On Tue, Jul 01, 2008 at 03:01:50PM -0400, Ed Heil wrote:
>> Hey all.  Is there any way to find out what dimensions a loaded image
>> has in Shoes, short of installing rmagick or something?  I'd like to
>> make an image viewer and have it resize images proportionately...
>> can't really do that by specifying absolute :height and :width values
>> unless you know what the starting height and width of the image
>> were....
>
> You can use `imagesize` to get the size without displaying the
> image.
>
>  === imagesize(path) » [width, height] ===
>
>  Quickly grab the width and height of an image.  The image won't be
>  loaded into the cache or displayed.
>
> The `width` and `height` of an image object will return its pixel
> size as well, but you'll need to check it before you resize it.
> From the manual:
>
>  === height() » a number ===
>
>  The vertical screen size of the element in pixels.  In the case of
>  images, this is not the full size of the image.  This is the height
>  of the element as it is shown right now.
>
>  If you have a 150x150 pixel image and you set the width to 50
>  pixels, this method will return 50.
>
>  Also see the [[width]] method for an example and some
>  other comments.
>
> _why
>

Reply via email to