Does anyone know if it is possible to use an image generated with KnpSnappyBundle inside a webpage?
I am able to render an image from html and send it as a response to the client:
$html = $this->renderView('YOPYourOwnPoetBundle:thePoet:poemJPG.html.twig', array(
'poem' => $customizedPoem,
));
$data = $this->get('knp_snappy.image')->getOutputFromHtml($html);
But I can’t seem to find how to use this image inside a html response. How should I use “$data”?
Thanks.
You might store the image on the filesystem and reference to it as usual.
If you don’t want to store the image you can always write a controller which would:
This way you could generate images on the fly.