I used the library to generate barcodes, but the problem is that I get the generated image How can I save?
Here I am giving my code which I have used:
In the Controller:
Add function ($ barcode) { $ PostData ['bar_code'] = $ this- & gt; Set_bar code ($ postData ['bar_code']); } Function set_barcode ($ code) {$ this- & gt; Load-> Library ('zend'); $ This- & gt; Zend-> Load ('Zend / Barcode'); $ Bar_code = Zend_Barcode :: Render ('code128', 'image', array ('text' = & gt; $ code), array ('imageType' =>> 'jpg')) - & gt; Draw (); Return $ bar_code; }
How can I save the image of the generated bar code?
Help as a son as possible.
Thank you!
I found the solution :
Function set_barcode ($ code) {$ this- & gt; Load-> Library ('zend'); $ This- & gt; Zend-> Load ('Zend / Barcode'); $ File = Zend_Barcode :: Draw ('code128', 'image', array ('text' = & gt; $ code), array ()); $ Code = Time () $ Code; $ Store_image = imagepng ($ file, "../ barcode / {$ code} .png"); $ Code back. '. Png '; }
Store the image using the imgepng function.
It will store bar code image in bar code folder.
No comments:
Post a Comment