2013-06-25 32 views
0

我通過在kohana 2.3中使用php生成條形碼。如何將隨機發生器代碼圖像保存到文件夾中

我只能查看條形碼圖像。

我無法將該圖像存儲到一個文件夾中。

我用下面的代碼

$coupon_code = text::random($type = 'alnum', $length = 6);              $img = $this->code128BarCode($coupon_code); 
     ob_start(); 
     imagepng($img); 
     //Get the image from the output buffer 
    $output_img  = ob_get_clean(); 
    echo '<img type="file" name="barcode" style="height:30px;width:100px;" src="data:image/png;base64,' . base64_encode($output_img) . '" />'; exit; 

幫我到圖像存儲到文件夾中。

回答

0

您必須以正確的方式使用imagepng將圖像保存在某處。像

imagepng($img, $saved_file_path); 

imagepng tutorial更多。

+0

非常感謝你kuldeep.kamboj ..它的工作很好..... –

相關問題