Giter Club home page Giter Club logo

Comments (8)

jackrusher avatar jackrusher commented on May 11, 2024 1

I agree that serving BufferedImages as visible images is useful, that's why we made that feature! In this case, it's not clear what we want to do inside html blocks, so there's going to be some design work around what feels right. :)

from clerk.

jackrusher avatar jackrusher commented on May 11, 2024

I have no idea what you had expected to happen in this case.

from clerk.

daslu avatar daslu commented on May 11, 2024

Thanks,

Here is the Slack discussion for reference:
https://clojurians.slack.com/archives/C035GRLJEP8/p1647906226495609

What I was wondering about was how to embed BufferedImage values in a Hiccup block.

from clerk.

jackrusher avatar jackrusher commented on May 11, 2024

The linked Slack thread doesn't make clear what output you might have expected given the semantics of clerk/html, which in turn leaves me unsure how to help you.

from clerk.

daslu avatar daslu commented on May 11, 2024

I might have expected to see the corresponding images inside the div, since typically, Clerk viewer types nest.

Edit:
But I was wondering about it too, still new to Clerk semantics.
This is documented as an Issue here simply because I was asked to do that on the Slack thread.

from clerk.

jackrusher avatar jackrusher commented on May 11, 2024

Let me try to refine my question a bit: if you are using the html viewer to build a hiccup representation of some HTML you would like to show the user, what would it mean to dump the binary data of an image in the middle?

I would expect something like [:img {:src (url-for (ImageIO/read ...))}] in this place so that you have control over the CSS applied to the element, can supply click handlers, and so on. (Note that this currently doesn't work! But to come up with a good solution that gives the user full power and no magic, we need to consider what should happen.)

from clerk.

daslu avatar daslu commented on May 11, 2024

Thanks, yes, I'm not sure about the desired API.

So, maybe the ticket title should have been: "What is the recommended practice for showing a few images in a div?".

A few thoughts:

  • Currently, a top-level form returning a BufferedImage just renders as an image in the Clerk notebook, without asking the user to care about serving it through a URL, etc.
  • This is quite useful. Example use cases:
    • The user is doing some image processing and wants to just see the resulting image.
    • The user is getting an image from a plotting library (e.g., cljplot) and just wants to see it.
  • I think that Clerk tends to render things (e.g., Vega plots) the same when nested inside a div and when not.
  • I think this kind of consistency is nice. That is probably what made me assume some desired behavior here.

from clerk.

mk avatar mk commented on May 11, 2024

@daslu it took a while but it's now working with a8c5102:
Screen Shot 2023-02-21 at 15 43 58

from clerk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.