SitePoint Sponsor |
|
User Tag List
Results 51 to 75 of 89
Thread: Create Barcodes
-
Aug 23, 2007, 11:06 #51
- Join Date
- May 2007
- Location
- Toronto, ON, Canada
- Posts
- 213
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
For a custom bar code, it is easy!
pro:
- very easy to code
cons:
- only you know how to read the code
- you need to make a program that can read the code
- Must be careful not to make images too similar
Here is a simple way I just thought of:
1) Have an image for each letter or number. Make sure they are all the same width and height if you want to resize it easily.
2) Replace each letter or number in your string with the image.
ereg_replace('A', '<img src="A.gif" alt=""/>', $barcode);
ereg_replace('B', '<img src="B.gif" alt=""/>', $barcode);
and so on...
or
PHP Code:$barcode = 'ABC';
$code = array ('A', 'B', 'C')
foreach ($code as $c) {
$barcode = ereg_replace($c, "<img src=\"$c.gif\" alt=\"\"/>", $barcode);
}
echo $barcode;
You can use the same type of logic with divs or 1x1 px images.
instead of replacing each caracter with an image, replace it with many images of certain heights/widths.
I strongly recommend you use something that is already out there if you want to have an easier time using it with a bar code scanner. (although I know nothing about the code that interprets the images... it might not be that difficult)
-
Aug 23, 2007, 11:07 #52
- Join Date
- Aug 2007
- Posts
- 40
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Create Code 25 Barcodes
Can someone give me a starting point, on how to grasp how barcodes are generated?
-
Aug 23, 2007, 11:36 #53
- Join Date
- Aug 2007
- Posts
- 40
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I now know the codes for the chracters, how do I convert the codes into bars?
'0' => '000110100',
'1' => '100100001',
'2' => '001100001',
'3' => '101100000',
'4' => '000110001',
'5' => '100110000',
'6' => '001110000',
'7' => '000100101',
'8' => '100100100',
'9' => '001100100',
'A' => '100001001',
'B' => '001001001',
'C' => '101001000',
'D' => '000011001',
'E' => '100011000',
'F' => '001011000',
'G' => '000001101',
'H' => '100001100',
'I' => '001001100',
'J' => '000011100',
'K' => '100000011',
'L' => '001000011',
'M' => '101000010',
'N' => '000010011',
'O' => '100010010',
'P' => '001010010',
'Q' => '000000111',
'R' => '100000110',
'S' => '001000110',
'T' => '000010110',
'U' => '110000001',
'V' => '011000001',
'W' => '111000000',
'X' => '010010001',
'Y' => '110010000',
'Z' => '011010000',
'-' => '010000101',
'*' => '010010100',
'+' => '010001010',
'$' => '010101000',
'%' => '000101010',
'/' => '010100010',
'.' => '110000100',
' ' => '011000100'
-
Aug 26, 2007, 10:39 #54
- Join Date
- Aug 2007
- Posts
- 40
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Barcode Type
Can anybody tell me what type of barcode is in the pictures at the following address, and how is it encoded?
http://www.freewebs.com/mail2go/Barcode.bmp
-
Aug 26, 2007, 10:40 #55
- Join Date
- Apr 2006
- Location
- Nottingham
- Posts
- 246
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Bar codes are binary.
-
Aug 26, 2007, 10:44 #56
- Join Date
- Aug 2007
- Posts
- 40
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
So would the barcode value for 284861 be: "1000101100010111101"?
-
Aug 26, 2007, 10:49 #57
- Join Date
- Apr 2006
- Location
- Nottingham
- Posts
- 246
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I couldn't say for sure, I'm afraid. I've never studied bar codes. Try having a look through the following information from HowStuffWorks.com. I'm sure they will give you a more in-depth answer.
-
Aug 26, 2007, 12:58 #58
- Join Date
- Aug 2007
- Posts
- 40
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
What type of Bar Code is it? Code 128, Code 39 etc.?
Last edited by F10; Aug 26, 2007 at 13:55.
-
Aug 27, 2007, 14:51 #59
- Join Date
- Aug 2007
- Posts
- 40
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Barcode
Hi,
What is the type of Bar Code found at the following URL:?
http://www.freewebs.com/f10f10/barcode.jpg
-
Aug 27, 2007, 15:08 #60
- Join Date
- Sep 2005
- Location
- Tanzania
- Posts
- 4,662
- Mentioned
- 2 Post(s)
- Tagged
- 0 Thread(s)
Tesco Stores is a British supermarket chain (biggest in the UK). I'm pretty sure that thing is something they swipe over the reader to top up someone's pre-paid mobile phone or buy some other item that isn't an actual object you can slap a barcode sticker on. I top up my mobile phone credit at Tesco and that's how they do it. They have a bunch of those on a keyring of sorts.
-
Aug 27, 2007, 20:34 #61
- Join Date
- Feb 2004
- Location
- Tampa, FL (US)
- Posts
- 9,854
- Mentioned
- 1 Post(s)
- Tagged
- 0 Thread(s)
if you're asking for the particular encoding of the barcode, i can print it and try and scan it with my reader tomorrow. but that's so low-resolution, it might not be able to be read.
alternatively, you can download the PEAR barcode class and render that number in all of the available formats and see which one matches.
-
Aug 27, 2007, 20:47 #62
- Join Date
- Feb 2004
- Location
- Tampa, FL (US)
- Posts
- 9,854
- Mentioned
- 1 Post(s)
- Tagged
- 0 Thread(s)
any chance you can post a higher-resolution scan of the barcode? and make it straight?
-
Aug 28, 2007, 03:30 #63
- Join Date
- Aug 2007
- Posts
- 40
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Barcode
How do I encode this type of barcode using PHP and 1 pixel images, for the black & white bars.
I have the following higher res image:
http://www.freewebs.com/f10f10/Barcode2.bmp
-
Aug 28, 2007, 03:37 #64
- Join Date
- May 2006
- Location
- Lancaster University, UK
- Posts
- 7,062
- Mentioned
- 2 Post(s)
- Tagged
- 0 Thread(s)
As longneck said, use the PEAR package's barcode class
Jake Arkinstall
"Sometimes you don't need to reinvent the wheel;
Sometimes its enough to make that wheel more rounded"-Molona
-
Aug 28, 2007, 03:50 #65
- Join Date
- Aug 2007
- Posts
- 40
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Is it not possible to use PHP and 1 pixel images?
-
Aug 28, 2007, 04:11 #66
- Join Date
- May 2006
- Location
- Lancaster University, UK
- Posts
- 7,062
- Mentioned
- 2 Post(s)
- Tagged
- 0 Thread(s)
Yes, PEAR is a part of PHP
Jake Arkinstall
"Sometimes you don't need to reinvent the wheel;
Sometimes its enough to make that wheel more rounded"-Molona
-
Aug 28, 2007, 05:40 #67
- Join Date
- Aug 2007
- Posts
- 40
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Barcode
Is it possible to use PHP, CSS, and 1 pixel images to create the barcodes?
-
Aug 28, 2007, 08:20 #68
- Join Date
- Feb 2004
- Location
- Tampa, FL (US)
- Posts
- 9,854
- Mentioned
- 1 Post(s)
- Tagged
- 0 Thread(s)
sure, if you want to completely reinvent the wheel.
also, that second scan is not really any better. i need something 300 or 600 dpi, non-interpolated.
-
Aug 28, 2007, 08:31 #69
- Join Date
- Feb 2004
- Location
- Tampa, FL (US)
- Posts
- 9,854
- Mentioned
- 1 Post(s)
- Tagged
- 0 Thread(s)
ok, i was able to clean up the image in photoshop and scan it. the barcode is EAN128. however, the data in the barcode is 9794022152508947, not 634004022152508947 like in the picture.
-
Aug 28, 2007, 08:59 #70
- Join Date
- May 2006
- Location
- Lancaster University, UK
- Posts
- 7,062
- Mentioned
- 2 Post(s)
- Tagged
- 0 Thread(s)
F10, Just please read the responses.
PHP's PEAR package makes it easy to do what you've asked, and saves alot of time. You don't need to go to any bother with CSS, it generates it all.
If you have any restrictions with PEAR, just say so instead of repeating the same question over and over again.Jake Arkinstall
"Sometimes you don't need to reinvent the wheel;
Sometimes its enough to make that wheel more rounded"-Molona
-
Aug 28, 2007, 09:59 #71
- Join Date
- Aug 2007
- Posts
- 40
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
-
Aug 28, 2007, 10:34 #72
- Join Date
- Feb 2004
- Location
- Tampa, FL (US)
- Posts
- 9,854
- Mentioned
- 1 Post(s)
- Tagged
- 0 Thread(s)
http://pear.php.net
if you can't install pear (it's probably already installed if you're on a shared host) or the image_barcode class is not already installed, you can just download the necessary class file from pear's website and extract them in your applications directory.
-
Aug 28, 2007, 11:37 #73
- Join Date
- Aug 2007
- Posts
- 40
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Create Barcode
Hiya,
Using nothing special but PHP, CSS, and 1 x 1 pixel images for the black and white bars, how do I create Code 128 bar codes?
Many Thanks, much appreciated!!!
-
Aug 28, 2007, 12:34 #74
- Join Date
- Mar 2006
- Location
- Netherlands
- Posts
- 1,661
- Mentioned
- 7 Post(s)
- Tagged
- 1 Thread(s)
Not trying to be rude, but haven't you already posted this question about three times before? There are lots of people trying to help you in those threads, read their answers, they tell you how to go about doing this...
-
Aug 28, 2007, 12:40 #75
- Join Date
- Jul 2005
- Location
- West Springfield, Massachusetts
- Posts
- 17,290
- Mentioned
- 198 Post(s)
- Tagged
- 3 Thread(s)
php barcode
Originally Posted by F10
Seriously though, you should check out the PEAR Image_Barcode package
http://pear.php.net/package/Image_Barcode
as simple as
PHP Code:Image_Barcode::draw('3773', 'code128', 'png');
Big Change Coming Soon - if you want your PMs save them now!
What you need to do to prepare for our migration to Discourse
A New SitePoint Forum Experience: Our Move to Discourse
Bookmarks