Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This can be done by simply creating a table with the following fields:

Field

Description

TOKEN_ID:

A unique identifier in the database, representing a singular QR URL, regardless or the token name or serial number

TOKEN_NAME:

The name of the token. For example, MTB18

TOKEN_SERIAL:

The serial representing the bottle number for the token. This is a number between 1 and the total number of minted tokens. For example, there were 16384 MTB18 tokens minted. Therefore, for MTB18, there would be a total of 16384 token serial numbers.

URL_DOMAIN:

The base URL_DOMAIN is:

HTTPS://NFT.OpenVino.org/

or

HTTPS://ó.ar/

Both domains point to the same IP address(es). The second, three-letter TLD is meant to shorten the overall QR-code URL. A shorter URL results in a less complex QR code, and therefore can be printed at a smaller size.

UNIQUE_ID

A random unique number.

QR_URL:

The QR_URL is a concatenation of:

URL_DOMAIN + TOKEN_NAME + TOKEN_SERIAL + UNIQUE_ID

PRINT_DATE

The date the label was printed (future use)

LABEL_DATE

The date the label was applied to the bottle (future use)

For example:

Code Block
ALTER TABLE your_table ADD COLUMN new_column TEXT;
ALTER TABLE your_table ADD COLUMN fourth_column TEXT;
ALTER TABLE your_table ADD COLUMN fifth_column TEXT;

UPDATE your_table SET 
  new_column = CONCAT(token_name, '.', LPAD(token_id::text, 5, '0')),
  fourth_column = CONCAT(new_column, '.', SUBSTRING(gen_random_uuid()::text, 1, 5)),
  fifth_column = CONCAT('https://ó.ar/', fourth_column);

...

Printing is currently done using the software Bartender.

At the time of printing, Bartender is capable of creating individual QR codes on-the-fly, reading the URL data from the table above.

Table Access

It is imperative that access to the database table containing the QR codes (and UNIQUE_ID’s) be limited only to two programs:

  • Label printing software (like Bartender)

  • The YDIYOI app

Print Registration

In future releases, the printing date (as reported by the label printing software) could be registered, as well as the label application date (as reported by the label application machine).

Variable Image printing

From this post.

BarTender can print unique labels at print time. In order to properly configure this, the file name of each image must match a field (cell) so at print time, the image name is matched to the image in the folder. 

First, create an image place holder on your label. Make sure that the image layer is moved to the back so your barcode and other data can print. If your barcode gets in the way of the image, you can create a shape object the size of your bar code and make sure that the shape is in front of the background image. The correct image will only show when connected to the data source. So initially, the label may show an enlarged icon that represents an image.

Next, right click on your label and select picture source and select External Picture. Then select "Get file name from database" by selecting the field name (cell)  that contains the image name. Right below that is an option to select the default path to the images.There are other options in the dialog box that will let you control the image position and layout to fit your output. 

This process merges the label with the image without any noticeable loss in speed. 

Identicons!

We wants to incorporate a distinct wine-themed identicon for every wine label, based on the wine bottle serial number.

Code Block
languagepy
from PIL import Image, ImageDraw
import hashlib

# Define the size of the identicon
size = 256

# Define the serial number for the wine bottle
serial_number = 'ABC123'

# Generate a hash of the serial number
identifier = hashlib.md5(serial_number.encode()).hexdigest()

# Initialize the Image and ImageDraw objects
img = Image.new('RGB', (size, size), color='white')
draw = ImageDraw.Draw(img)

# Define the colors to use in the identicon
bg_color = (220, 20, 60)  # Crimson
fg_color = (255, 255, 255)  # White

# Draw the background
draw.rectangle((0, 0, size, size), fill=bg_color)

# Draw the circles and lines
for i in range(0, len(identifier), 2):
    x = int(identifier[i], 16)
    y = int(identifier[i + 1], 16)
    radius = int(size / 16)
    draw.ellipse((x * radius, y * radius, (x + 1) * radius, (y + 1) * radius), fill=fg_color, outline=None)
    draw.line((x * radius, y * radius, (x + 1) * radius, (y + 1) * radius), fill=bg_color, width=2)
    draw.line((x * radius, (y + 1) * radius, (x + 1) * radius, y * radius), fill=bg_color, width=2)

# Draw the wine glass icon
wine_glass_icon = Image.open('wine_glass.png').convert('RGBA')
wine_glass_icon = wine_glass_icon.resize((80, 80))
mask = Image.new('L', (80, 80), color=255)
img.paste(wine_glass_icon, (size - 80, size - 80), mask)

# Save the identicon to a file
img.save('identicon.png')