Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Image size in ListGrid

    Hi all,
    I'm having trouble setting up the size of an image in a ListGridField of ListGridFieldType.IMAGE. I can't find a way to preserve image aspect ratio.

    In a TileGrid, it works fine. I use the setImageHeight() method to make the height of thumbnails constant, and the images center themselves in the created space, preserving their aspect ratios.

    In a ListGrid, the image always seems to stretch to the dimensions that I specify through imageWidth and imageHeight. Unfortunately, in my application, there's no way to know the exact dimensions of the image beforehand.

    Thanks in advance for any remarks.

    #2
    In the Yahoo image search example you can see a technique for integration image sizes into the returned data.

    If the sizes are truly unknowable, don't use fieldType "image", just use an <img> tag returned by a formatter. But set cellHeight large enough to accommodate the maximum image you might have.

    Comment

    Working...
    X