Clickable Images

I’m assuming I would just setup the image to have a link to use the url or how might this work? In the picture below which is coming from a media object in my db I would also like the user to be able to click it to get a bigger image of it, I guess somehow maybe on the show I can have a function that sets up a hyperlink to it or has anyone else done something similar to this before?

BTW I was amazed how easy this was to get the image stuff setup for uploading kudos on that.

Links are actually containers! You can put anything inside a Link to make it clickable. Just set the text property to an empty string to get rid of the text.

A nice idea might be to open the images in an alert, like so:

  def link_1_click(self, **event_args):
    """This method is called when the link is clicked"""
    alert(
      Image(source=self.image_1.source, height=640),
      buttons=[('Back', None, None)],
      large=True,
    )

Otherwise you could have an ‘expanded image’ Form that you open within the gallery, or just redirect to the raw image. There’s a few ways of doing it!

5 Likes

Nvm I figured out how to finally get the image in the link container and it works, thanks

Now when you click that image you get your alert image like you mentioned, great idea btw exactly what I was looking for.

ha this is a great idea, now I think I’m going to add a button to change the picture, etc. I’m sure that just means I add a button there like you have and set it up to call a function.