[TYPO3-mvc] Rendering a picture

"Christian Müller (Kitsunet)" christian at kitsunet.de
Sun Jun 14 19:54:58 CEST 2009


Xavier Perseguers wrote:
> Hi,
> 
> Sorry if this question was already answered but I did not find it. It's 
> a bit related to the vCard question from Susanne.
> 
> I try to use EXT:sav_jpgraph to render graphs. Basically, this extension 
> just provide the well-known graph library jpgraph.
> 
> my setup is as this (relevant part):
> 
> -- index.html --
> 
> <p><f:link.action action="show">Show a graph</f:link.action></p>
> <img src="{f:uri.action(action='show')}" />
> 
> 
> -- ext_tables.php --
> 
> Tx_Extbase_Utility_Plugin::registerPlugin(
>     'MyGraphExt',
>     'Pi1',
>     'Graphs',
>     array(
>         'Graph' => 'index,show',
>     ),
>     array(
>         'Graph' => 'show',
>     )
> );
> 
> 
> -- GraphController.php --
> 
> public function showAction() {
>     $this->view = NULL;
>        
>     include t3lib_extMgm::extPath('sav_jpgraph') . 'src/jpgraph.php';
>     include t3lib_extMgm::extPath('sav_jpgraph') . 'src/jpgraph_line.php';
>     
>     $graph = new Graph(300, 200, 'auto');   
> 
>     // stuff to create graph
> 
>     // Fix bug http://forge.typo3.org/issues/show/3540
>     ob_clean();
> 
>     // Render the graph
>     $graph->Stroke();
> }
> 
> Questions:
> 
> 1) The view is rendered only once, I get the text "show graph" only 
> after a FE clear, when I refresh the page, it is empty until I clear 
> again the cache. If I set the no-cache parameter on the page, this does 
> not work better. This is a real problem and the only way I found to 
> prevent this is to use Christian Müller's id to use a eID and 
> instantiate Extbase myself. It is not really nice.
> 
> 2) Action "show" renders the whole page, I have to add an "exit" 
> statement after $graph->Stroke(); to prevent this. Is there another 
> "official" solution?
> 

I do not think this is something to be done with an Action. Maybe you 
should write out the image to typo3temp and render img Tag or return img 
URL. Or well, maybe it would be a good idea to implement an official 
"exit" stragy...

cheers
Christian


More information about the TYPO3-project-typo3v4mvc mailing list