The following example demonstrates the typical use of the ClearImage COM . This particular example reads 1D barcodes from an image file. However, by referring
to the online help you can easily use any of the other available methods.
| Barcode Recognition in PHP | Copy Code |
|---|---|
<?php // Create and Configure ClearImage Object $Ci = new COM("ClearImage.ClearImage"); // Create the 1D Barcode Pro object. // You can use any of the other engines here. $Bc = $Ci->CreateBarcodePro(); // Open file. Use your own file name obviously $Bc->Image->Open('c:\barcodes.jpg'); // Set reading parameters. Update values if needed // See Online API help $Bc->AutoDetect1D = 65535; $Bc->Directions = 1; $Bc->Algorithm = 2; // Retrieve and Count Barcodes, print count $BCcount = $Bc->Find(0); echo "<br>Barcodes: $BCcount<br>"; // Print Text Representation of each barcode for ($i=1;$i<=$BCcount;$i++) { echo "Barcode #$i "; $FBc = $Bc->BarCodes($i); $FBc_Value = $FBc->Text; $FBc_Type = $FBc->Type; echo "$FBc_Type $FBc_Value<br>"; } ?> | |