YOURLS-QRCode-Plugin icon indicating copy to clipboard operation
YOURLS-QRCode-Plugin copied to clipboard

Easy Installation & Customizations

Open zmweske opened this issue 11 months ago • 1 comments

Hello, if you want to use this plugin but do so with the official docker image while also customizing some of the hidden options for this plugin that you might not like, here are a few things that I did:

  • instead of using image: yourls in your docker compose, use build: path/to/dir_with_dockerfile and inside dir_with_dockerfile create Dockerfile with the following contents:
FROM yourls:latest

RUN curl -sSL https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions -o - | sh -s gd @composer

Then run docker compose exec -it yourls /bin/bash and cd user/plugins/seans-qrcode && composer install

  • Make the qr code button in the admin page show up/hide with the rest of the buttons (share, edit, etc) comment out plugin.php:135 (/* visibility: visible !important; */)
  • Remove the logo by changing plugin.php:23 to defined('SEAN_QR_LOGO_SPACE') or define('SEAN_QR_LOGO_SPACE', 0); as the environment variable doesn't seem to work.
  • Change the QR code version to ~~a lower number (maybe 4 or 5)~~ -1 on plugin.php:72: $options->version = -1; The point of this change is to create a smaller qr code. The biggest seller to use this plugin was the fact that it could be used with the case-insensitive plugin to be able to create smaller codes but then it created much larger ones anyways. ~~Note--- if this number is too low given the length of slugs created automatically or manually, the image generation doesn't seem to work~~ EDIT- it looks like setting version to -1 will automatically choose the smallest version number
  • I'm working to reduce the ECC level from 30% redundancy (ECC_H) to 7% redundancy (ECC_L) but it doesn't generate when I do that regardless of the version number/size. It doesn't seem to like using ECC_L, 0b01, or 0, any of which might work.
  • I have also added this tag to the share box on the public page (with sleeky, it's under index.php at the root): <img src="<?php echo $shorturl; ?>.qr"/>

zmweske avatar Mar 10 '24 20:03 zmweske

@seandrickson or anyone else, let me know if there's a way to change the ecc level that you can find. The numbers above were referenced from the vendor source code and not what is found on GitHub for some reason (...../user/plugins/seans-qrcode/vendor/chillerlan/php-qrcode/src/QRCode.php) Upon further inspection, ECC_H might be what to use anyways? It appears that ECC_L and ECC_M both have a larger MAX_BITS value, despite presumably meaning L->low, M->medium, H->high. Idk What I do know is that with an app I use on my phone to verify, it says that qr codes generated have 30% redundancy and when I generate one using my app, they are smaller than what this plugin does by default.

zmweske avatar Mar 10 '24 21:03 zmweske