The «QR Code Generator» service gives the user an opportunity to receive a graphic QR code equivalent to a text, link, e-mail address or other data in a text format. Currently, the maximum input length is limited to 100 symbols.
Basic terms and concepts
QR code (Quick Response Code) – a popular two-dimensional barcode format. These codes are also known as «hard links» or «hyperlinks of the physical world». The text encrypted with a QR code can be anything – for example, a URL, contact information, even a poem. Technically, a small (up to approximately 3 Kb) graphic or audio information in binary format can also be converted into a QR code. QR codes can be read by an optical device with appropriate software. Such devices range from special QR code readers to mobile phones. QR code technology patent JP2938338 (in English translation) – https://patents.google.com/patent/JP2938338B2/en
GET method – a method for requesting the contents of a specified resource. This method is the most common. A GET request is a transfer of data having the syntax http://domain/page?[Parameter1=value1]&[parameter2=value2]&…&[parameterX=valueX]. Data entry begins with the character ?, the data pairs «parameter= value» are separated by the ampersand character (&).
Practical value
The practical value of the service is determined primarily by the degree of prevalence, ease of use and areas of using of QR codes. Among the areas and methods of using are the following: product tracking, item identification, time tracking, document management, general marketing.
More specifically, the service will be useful to manufacturers of various goods who want to provide products or their packaging with additional information that can be read from a mobile device, to service providers who want to place additional information (types of services, contact details) on their advertising products (posters, banners, leaflets, billboards, etc.), to the organizers of various events, including fundraising events using SMS messages. QR codes obtained using our service can also be used in the field of education to supply educational material with additional, easily readable information, or data necessary for educational applications working with augmented reality.
Service features
1) The service does not produce QR codes on its own, but generates the correct GET request to the QR Codes API hosted on Google Charts and presents the results of its work. This leads to two circumstances:
– offline work with the service is impossible;
– the final format of the graphic file matches the format in which the API packs the result (this is the PNG format).
The speed and quality of the algorithms of the API have been repeatedly tested by us and found to be satisfactory.
2) Due to the features of the software implementation, at the moment the maximum allowable length of the input text is 100 characters.
3) The resolution of the final file of the QR code is 150×150 pixels.
Service work algorithm
Algorithm input data:
- User text input, UText;
- Size of the final graphic file on the X and Y axis, Size;
- Error correction level (in case of loss, misinterpretation or ambiguity of data), ErrLevel;
- The width of the white border around the graphic data, Marg.
The beginning of the algorithm.
Step 1. Receiving text data UText from the user.
Step 2. Determinating values of parameters Size (150), ErrLevel (“L”), Marg (0). Formation of the set <Size (X), Size (Y), ErrLevel, Marg, Utext>.
Step 3. Generating a GET request to the QR Codes API basing on the values of the elements of the set <Size (X), Size (Y), ErrLevel, Marg, Utext>.
Step 4. Sending the GET request to the QR Codes API.
Step 5. Obtaining results in graphical format and displaying them to the user.
The end of the algorithm.
User interface description
The graphical interface of the service is shown in Figure 1.
Figure 1 – The user interface of the service «QR code generator»
The user has the opportunity to enter text data for subsequent conversion into a QR code in a special text field. This field is equipped with the «Refresh» button (return to default data) and the «Clear» button (deleting data from the field).
To get a QR code, the user must click the «Generate!» button located under the text input field.
A possible result of the service work is presented in Figure 2.
Figure 2 – The result of the service work
The user can save the graphic file with a QR code using standard browser functions. However, for convenience, after generating the QR code, the “Download” link also appears in the interface.
User scenario of work with the service
1. Enter text data in the input field
2. Click the «Generate!» button
3. Save the result of the work (graphic file)
Access to the service via the API
To access the «QR Code Generator» service via the API, you need to send an AJAX request of the POST type to the address https://corpus.by/QRCodeGenerator/api.php.
Elements of the input data array have the following parameters:
localization – the language of the service interface. If this parameter is not specified, the default language will be English (“en”).
url – text data to convert to a QR code. If not specified, an empty string will be used by default.
An example of AJAX request:
$.ajax({
type: “POST”,
url: “https://corpus.by/QRCodeGenerator/api.php”,
data:{
“localization”: “en”
“url”: “https://corpus.by”
}
Success: function(msg){}
});
The server will return a JSON array with the input text data (url parameter), generated GET request to the QR Codes API (resultUrl parameter), a relative link to the location of the QR code graphic file on the server (resultFilepath parameter) and file name (resultFilename parameter). For example, by the above AJAX request, the following response can be generated:
[
{
“url”: “https://corpus.by”,
“resultUrl”: “http://chart.apis.google.com/chart?chs=150×150&cht=qr&chld=L|0&chl=https%3A%2F%2Fcorpus.by”,
“resultFilepath”: “../_cache/QRCodeGenerator/out/2020-03-06_15-31-18_80-94-171-2_874_out.png”,
“resultFilename”: “2020-03-06_15-31-18_80-94-171-2_874_out.png”
}
]
Service page – https://corpus.by/QRCodeGenerator/?lang=be