[Borges-users] Dynamically creating images with Borges

Michael Neumann mneumann at ntecs.de
Mon May 3 15:45:06 EDT 2004


On Mon, May 03, 2004 at 10:31:00PM +0400, ??????? ???????? wrote:
> >The problem is not the image generation, but how to send the image data
> >back to the client (register a callback/url). 
> 
> Here's how I did it 5 minutes ago (this is from a controller's 
> render_on(r)):
> 
> data = File.open('plasm.jpg') {|f| f.binmode; f.read} # we have some 
> binary data
> r.image r.url_for_document(data,"image/jpeg") # we make the image's 
> URL point to this data, with a mime-type

Hm, this way the image is the same for all sessions, isn't it? And the
URL will not be reclaimed (it will stay forever).

What I'd like to have is the following:

  a = proc {
    # generate image
    # and return image data to client
  }

  r.image(r.url_for(&a), "my image")

Furthermore, I'd like to interpret the URL sent by the browser for the
image to generate. Because if the image is for example an imagemap, the
browser appends the mouse position at the URL (e.g. ?10,10 if you click
at x=10, y=10 with the mouse).

Oh, Borges model is great, but it's a bit hard to understand... it's
probably too magic :-)

Regards,

  Michael


More information about the Borges-users mailing list