EAN

From ChaosReligion

Jump to: navigation, search

The EAN BarCode generator extension can create a picture of a Code39, Codabar, EAN-13, an EAN-8 or a UPC-A barcode by only adding the EAN-Tags with the barcode number to the article (concerning the EAN/UPC barcode its enough to specify the first 12 (EAN-13), the first 7 (EAN-8) or the first 11 (UPC-A) digits, the following check-digit will be calculated anyway):
For example, the barcode 4007574006243 will be added with the following wiki code to the article: <barcode>4007574006243</barcode>

This code, added to any MediaWiki with the EAN BarCode generator extension will generate the following picture:
Image:Ba3597886a0037df1047f67232d720c7.png

You can change any barcode to a bigger size by adding the option size=X to the opening tag (X is ofcourse the size-number, like 1 or 2).

You can also use normal image options just like you would with wikipedia images. If you would add an image like this:
[[Image:somepic.jpg|thumb|400px|left|This is some text.]]
the bold part is the part you would add as "options" parameter to the opening tag. For the barcode this would look like the following:
<barcode code="ean" size=1 options="thumb|400px|left|This is some text.">1234567890123</barcode> In live this would produce the following picture:

This is some text.
This is some text.

Since version 2, the pictures are added to your MediaWiki just like any other picture, and therefore, no more used pictures can be found with the "Unused images" special-page and deleted. It also gives you the possibility to arrange the picture more like you want to, just like normal pictures (see the options parameter described above).

Another example with a bigger size would be: <barcode size=1>5901234123457</barcode>
Image:9b66dfa689902fbf04144b6805958c6b.png

With the "code" parameter you define the barcode you want to display. Standard is "EAN-13" but you can also choose EAN-8 (code="ean8") or UPC (code="upc").

An EAN-8 example would be: <barcode code="ean8">4632937</barcode> or <barcode code="ean8" size=1>4632937</barcode> just with a bigger size
Image:D7c2768c7518968388cb9d26ed5ee5c9.png Image:127aa6200ebc7bf4efbecd6ce07908c5.png

And a UPC-A example would be: <barcode code="upc">07928303647</barcode> or <barcode code="upc" size=1>07928303647</barcode> again with a bigger size
Image:E4ff0110c7605955a73cb1f774878a59.png Image:Fb23f0bf57d068a17614cbb4ded1bb38.png
Please remember that UPC barcodes must always begin with a zero (0)!

The following is a Code39 example (Code39 was added in Version 2.1):
<barcode code="code39">EAN VERSION 1.2</barcode>
Which will result in the following barcode:
Image:50a022c77b9a6cfcfae4bac9b17d19e9.png

The following is a Codabar example (Codabar was added in Version 2.1):
<barcode code="codabar">a446$88109b</barcode>
Which will result in the following barcode:
Image:475e3a54eb5d8bc378c7bf469c4835d2.png


Contents

Sandbox

You can play in the Sandbox with the EAN tags by adding any barcode number you like within the EAN tags to the page. You'll see, it works!

Download

EAN extension in zip format (current version: 2.1)

Install instructions

  • Unpack the package into your "extensions" subdirectory of your mediawiki installation (you may need to rename the new directory to "ean").
  • Add the following line to the bottom of the LocalSettings.php file in your mediawiki home/main directory:

require_once("$IP/extensions/ean/ean.php");

  • If you get a warning after the first trying of adding a barcode to an article (something like: no permission) and the picture doesn't appear you will have to do the following: Create the directory "ean" in the subdirectory "images" of your MediaWiki installation and make sure the webserver has reading and writing access to this new directory (in linux you'll have to change the permission of the directory to "0777").

Source-Code Description

Personal tools