[TYPO3-english] Re: links to generated image files - to inside extension Public folder or out: best practise?

Calgacus map Brude calgach at gmail.com
Tue Nov 12 23:09:09 CET 2013

after a little more tinkering this seems to work when creating files:
$fullpath =  PATH_site . 'fileadmin/barcodes/' .$newCoupon->getBarcode();
if ( ! file_exists( $fullpath .'png') ) {   //don't bother creating if it already exists
                    $barc  =  barcode_outimage( $fullpath, $bars['text'], $bars['bars'], 2, 'png' );

and later to create links in my show action:
$filename =    '/fileadmin/barcodes/' .$coupon->getBarcode().'.png';
$this->view->assign('filename', $filename);
$this->view->assign('coupon', $coupon);

and in my template:
<img src="{filename}"  height="120" width="216">	

but is this the right style or just a horrible hacky way of doing it? perhaps it is a non-extbase way, an old p1 way.


More information about the TYPO3-english mailing list