Save generated bar code image in database and in folder using codeigniter

前端 未结 2 1994
感动是毒
感动是毒 2021-01-03 19:02

I have used library to generate barcode. Bar code is generated but problem is that how can i save that generated image?

Here i am giving my code i have used:

2条回答
  •  半阙折子戏
    2021-01-03 19:27

    I got the solution:

    function set_barcode($code)
    {
       $this->load->library('zend');
       $this->zend->load('Zend/Barcode');
       $file = Zend_Barcode::draw('code128', 'image', array('text' => $code), array());
       $code = time().$code;
       $store_image = imagepng($file,"../barcode/{$code}.png");
       return $code.'.png';
    }
    

    store the image using imgepng function.
    it will store the bar code image in barcode folder.

提交回复
热议问题