- This template is inspired by QRChem by Professor Neil Garg and his QRChem team. However, this template allows users to upload their own structures and not just structures existing in Pubchem database.
- What this template is: This is a simple template for auto generation of QR code for uploaded molecules. This template does:
- Upload structural files to a pre-determined folder on server via http or https
- Generate a QR code to the 3D viewer (using 3DMol.js) for the uploaded files
- What this template is NOT: it does not optimize (i.e. energy minimization) the structure input so the structures will need to be optimized before uploading.
- Server access
- PHP 5+
-
Clone this github to your local server:
-
Modify the url for your 3D Viewer page in
qrgenerator.php
by setting$viewerUrl
by replacinghttp://localhost
in the following line with your webpage url:$viewerUrl = 'http://localhost/3dviewer.html?file=' . $fileNameWithoutExtension;
-
Modify the upload folder, currently
upload/structures
in:- upload.php:
$uploadFileDir
- 3dviewer.html:
file
- upload.php:
-
(Optional) Modify the requirement for uploaded files in
upload.php
. Current settings:- Only allows
*.mol
and*.xyz
files. Change by modifying$allowedfileExtensions
- Only allows files smaller than 5 MB. . Change by modifying
$fileSize
- Only allows
-
(Optional) Modify the file format for QR code by replacing
.svg
in$imageName
in qrgenerator.php. Options include: '.png', '.gif', 'jpeg', 'jpg', 'svg', and 'eps'. More info here -
Copy these files into your web folder:
- qrgenerator.php
- upload.php
- 3dviewer.html
-
Make sure the webserver user (i.e. 'apache' on CentOS 7 or 'www-apache' on Ubuntu) has read and write access to the:
- Upload folder
- qrgenerator.php
- upload.php
- 3dviewer.html
-
Enjoy!
All questions, comments, suggestions are welcomed! Please consider creating a new issue.