/ ******************************************************************* *********************** Written by caocao caocao@eastday.com http://nethermit.yeah.net Displays Code39 barcode: $ Convert = new code39; $ str = $ convert-> decode ($ STR); ***************************************** ********************************************************** / Class Pattenclass {var $ color; var $ width Function Pattenclass ($ Color, $ Width) {$ this-> color = $ color; $ this-> width = $ width;}} class code39 {var $ zoom; var $ patten = array (); Function Code39 ($ zoom, $ heiGHT) {$ zoom = intVal ($ zoom); $ this-> zoom = $ zoom <1 || $ zoom> 20? 3: $ zoom; $ height = intVal ($ heiGHT); $ this-> Height = $ HEIGHT <1 || $ HEIGHT> 80? 30: $ Height; $ this-> Patten [] = New Pattenclass ("# ffffff", 1 * $ this-> zoom); $ this- > Patten [] = New Pattenclass ("# ffffff", 3 * $ this -> zoom; $ this-> Patten [] = new pattenclass ("# 000000", 1 * $ this-> zoom); $ this-> Patten [] = new Pattenclass ("# 000000", 3 * $ THIS -> zoom);} Function makecode ($ code) // code39 decoded {switch ($ code) {case "0": Return ("202130302"); case "1": Return ("302120203"); Case "2 ": RETURN (" 203120203 "); Case" 3 ": Return (" 303120202 "); Case" 4 ": Return (" 202130203 "); Case" 5 ": Return (" 302130202 "); Case" 6 "
: Return ("203130202"); Case "7": Return ("202120303"); Case "8": Return ("302120302"); Case "9": Return ("203120302"); Case "a": return ("302021203"); Case "B": Return ("203021203"); Case "C": Return ("303021202"); Case "D": Return ("202031203"); Case "E": Return (" 302031202 "); case" f ": RETURN (" 203031202 "); Case" G ": Return (" 202021303 "); Case" H ": Return (" 302021302 "); Case" I ": Return (" 203021300 " Case "J": Return ("202031302"); Case "K": Return ("302020213"); Case "L": Return ("203020213"); Case "M": Return ("303020212"); Case "N": Return ("202030213"); Case "O": Return ("302030212"); Case "P": Return ("203030212"); Case "Q": return ("202020313"); case " R ": Return (" 302020312 "); Case" S ": Return (" 203020312 "); Case" T ": Return (" 202030312 "); Case "U": Return ("312020203"); Case "V": Return ("213020203"); Case "W": Return ("3130202"); Case "X": Return ("212030203"); casse Y ": Return (" 312030202 "); Case" Z ": Return (" 213030202 "); Case" - "
: Return ("212020303"); case ": Return (" 312020302 "); case": return ("213020302"); case "*": return ("212030302"); Case "$": return "212121202"); case "/": Return ("212120212"); Case " ": Return ("212021212"); Case "%": Return ("202121212");} return ("212030302");} Function Display // Output Single Character {$ Output = ""; for ($ I = 0; $ I <9; $ I ) $ OUTPUT. = "