> > When I create a new GD::Image drawing whatever on it and trying
> > to print it - it will be prepended to my html header for the
> > page. I then tried to put it in $m->out to have in printed within
> > Mason, but that simply printed the raw PNG in all its glory as
> > text on screen.
> >
> > I tried fiddeling with content_type, but I guess that wont work
> > if I set this after I have already printed something on the page
> > - hence the content_type will not even be effective for that page.
> >
> > What I still miss doing/trying is making a seperate
> > file/component which only job will be to make the PNG, but I
> > don't really see what I would gain from that, because that will
> > pretty much also just print a PNG "within" my HTML page.
> 
> First of all, there's a mason users list
> (http://www.masonhq.com/resources/mailing_lists.html).
I am using it already, but saw no harm in trying my luck at the mod_perl list, since 
it's not entirely Mason related in my eyes.

> 
> Second, you don't seem to understand how images in a web page works.
> When your browser sees <img src="foo"> it makes a _seperate_ 
> request for foo from the web server.
Thanks. I don't know _what_ I was thinking just printing it bare
on the page.

> 
> The image is not somehow magically inlined in the page and 
> served with the request for the page itself.
That I could also easily conclude - but that didn't stop me from
continuing on bad track - unfortunately :)

> 
> What you need is a seperate top-level Mason component that
> generates the image.  Use this as the value for the src attribute
> like <img src="foo.comp?size=2">.  Then make sure that foo.comp
> prints the correct headers.
That will be my next thing to do - as I almost implied myself. Thank you for verifying 
/ suggesting the correct way.

> 
> And yes, you need to use $m->out, not print (this is documented in
> the Mason docs).
I have been reading the Mason docs. and know that I shouldn't be using
"print", but I was simply trying whatever possible to see the differences.

Best regards

Nicolai




Reply via email to