SitePoint Sponsor

User Tag List

Page 3 of 4 FirstFirst 1234 LastLast
Results 51 to 75 of 89

Thread: Create Barcodes

  1. #51
    SitePoint Addict agentforte's Avatar
    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 even specify the height and width of each piece.

    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)

  2. #52
    Non-Member
    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?

  3. #53
    Non-Member
    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',
    '&#37;' => '000101010',
    '/' => '010100010',
    '.' => '110000100',
    ' ' => '011000100'

  4. #54
    Non-Member
    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

  5. #55
    SitePoint Addict Wildhoney's Avatar
    Join Date
    Apr 2006
    Location
    Nottingham
    Posts
    246
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Bar codes are binary.
    TalkPHP.com - The Friendly PHP Community

    Watch Reaper Online - Watch Chuck Online

  6. #56
    Non-Member
    Join Date
    Aug 2007
    Posts
    40
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So would the barcode value for 284861 be: "1000101100010111101"?

  7. #57
    SitePoint Addict Wildhoney's Avatar
    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.
    TalkPHP.com - The Friendly PHP Community

    Watch Reaper Online - Watch Chuck Online

  8. #58
    Non-Member
    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.

  9. #59
    Non-Member
    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

  10. #60
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    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.

  11. #61
    reads the ********* Crier silver trophybronze trophy longneck's Avatar
    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.

  12. #62
    reads the ********* Crier silver trophybronze trophy longneck's Avatar
    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?

  13. #63
    Non-Member
    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

  14. #64
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    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

  15. #65
    Non-Member
    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?

  16. #66
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    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

  17. #67
    Non-Member
    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?

  18. #68
    reads the ********* Crier silver trophybronze trophy longneck's Avatar
    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.

  19. #69
    reads the ********* Crier silver trophybronze trophy longneck's Avatar
    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.

  20. #70
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    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

  21. #71
    Non-Member
    Join Date
    Aug 2007
    Posts
    40
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Barcode

    Quote Originally Posted by arkinstall View Post
    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.
    OK, Sorry

    I don't want to use PEAR. How else can this be done?
    What actually is PEAR, and what needs to be installed in order to use it. Does the end user need any special software etc?

  22. #72
    reads the ********* Crier silver trophybronze trophy longneck's Avatar
    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.

  23. #73
    Non-Member
    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!!!

  24. #74
    SitePoint Wizard bronze trophy Immerse's Avatar
    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...

  25. #75
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,290
    Mentioned
    198 Post(s)
    Tagged
    3 Thread(s)

    php barcode

    Quote Originally Posted by F10
    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?
    Not very easily.
    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'); 


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •