การสร้าง Barcode ใน Yii Framework
มานพ กองอุ่น 19 ก.พ. 2014 10:17:16 5,016
ใน Yii Framework มี Extension เสริมที่จะช่วยให้เราสร้าง Barcode ได้นั่นก็คือ Barcode-Generator โดยสามารถดาวโหลดได้ที่ Barcode Generator
วิธีการใช้งาน
- นำไปวางไว้ใน protected/extensions/barcode
- เขียนคำสั่งในการสร้าง Barcode
//Widht of the barcode image.
$width = 284;
//Height of the barcode image.
$height = 184;
//Quality of the barcode image. Only for JPEG.
$quality = 100;
//1 if text should appear below the barcode. Otherwise 0.
$text =1;
// Location of barcode image storage.
$location = Yii::getPathOfAlias("webroot").'/bc';
Yii::import("application.extensions.barcode.*");
barcode::Barcode39('some text', $width , $height , $quality, $text, $location);
ตัวอย่าง