Announcement

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

    Best practice: Showing a uploaded (fieldtype="binary") image in a ListGrid Hover

    Hi Isomorphic,

    I have a Form+ListGrid (no TileGrid) like in this sample, with the small difference that the user can upload any type of file.
    My usecase the the following: I want to display the image in a Hover (if it is actually an image).
    I can create the additional ListGridField with an placeholder image like the one you can already click to open the binary data in a new window.
    The hover then will only show if the extension in the filename is actually .jpg, .png etc. I can do that as well.

    But how to proceed from here? I read this thread.
    I assume it is another fetch to an operationId with output returning an Base64-encoded version of the image.
    But then there is the problem with the unknown image dimensions. Could you describe how to solve this best, having a hover with just the image and some "hoverborder" around the image?
    (I assume that image TileGrids use a similar approach, at least with respect to the data download.)

    I'm using recent 5.0p.

    Thank you & best regards
    Blama

    #2
    Just use DataSource.getFileURL() to obtain a URL to the image. This is a synchronous. The returned URL can be used with a plain HTML <img> tag or with an Img widget, or anywhere else a URL to an image is valid.

    Comment

    Working...
    X