如何:显示动态生成的图像而不将其写入光盘 - 来自typo3 v4.5 extbase扩展?

I am generating barcode images (using PHP-Barcode 0.4 http://www.ashberg.de/php-barcode/) with imagepgn but would rather not save them to disc - just seems unnecessary as the images aren't needed for long and they are small and quick to generate when needed.

I was thinking of an action showbarcodeAction that would just call the imagepgn function but there needs to be a template associated with the action right? And if so won't it produce some html when all I really need is the image? can I show the image in a standard img tag even though it is not actually saved to disc?

I am using typo3 v4.5 with extbase.

Thanks!

(Q also posted at http://forum.typo3.org/index.php/m/698624/#msg_698624 because when I tried to post it here first some error prevented this site from accepting it)

If you want to do it "your style", then generate your image in an action, modify the headers to return the right MIME type and add an exit at the end of your action. The exit will prevent Extbase from calling the view and therefore you won't need a Template.

This post could inspire you: http://buzz.typo3.org/people/soeren-malling/article/create-a-download-action-with-extbase/ You just need to remove the "push file" parts (content-description).

Personally I would go for the base64 way: Generate the image, encode it with base64 (PHP: base64_encode) and pass it to your Fluid template.