Set default value for size and margin, fix $qrSize

This commit is contained in:
Miraty 2022-05-31 16:05:57 +02:00
parent acc7409bfe
commit 449d9634db
2 changed files with 6 additions and 16 deletions

View File

@ -14,7 +14,7 @@ define("CUSTOM_TEXT", "This LibreQR instance is hosted by <a href='https://foo.e
// Default values // Default values
define("DEFAULT_REDUNDANCY", "high"); define("DEFAULT_REDUNDANCY", "high");
define("DEFAULT_MARGIN", NULL); define("DEFAULT_MARGIN", 20);
define("DEFAULT_SIZE", NULL); define("DEFAULT_SIZE", 300);
define("DEFAULT_BGCOLOR", "FFFFFF"); define("DEFAULT_BGCOLOR", "FFFFFF");
define("DEFAULT_MAINCOLOR", "000000"); define("DEFAULT_MAINCOLOR", "000000");

View File

@ -171,13 +171,7 @@ foreach($themeDimensionsIcons as $dimFav) // Set all icons dimensions
<?= $loc['help_margin'] ?> <?= $loc['help_margin'] ?>
</p> </p>
</details> </details>
<input type="number" list="margins" id="margin" placeholder="<?= $loc['placeholder_pixels'] ?>" name="margin" min="0" max="1024" value="<?= htmlspecialchars($params['margin']) ?>"> <input type="number" id="margin" placeholder="<?= $loc['placeholder_pixels'] ?>" name="margin" required="" min="0" max="1024" value="<?= htmlspecialchars($params['margin']) ?>">
<datalist id="margins">
<option value="16">
<option value="32">
<option value="64">
<option value="128">
</datalist>
</div> </div>
<div class="param"> <div class="param">
@ -187,13 +181,7 @@ foreach($themeDimensionsIcons as $dimFav) // Set all icons dimensions
<?= $loc['help_size'] ?> <?= $loc['help_size'] ?>
</p> </p>
</details> </details>
<input type="number" list="sizes" id="size" placeholder="<?= $loc['placeholder_pixels'] ?>" name="size" min="1" max="4096" value="<?= htmlspecialchars($params['size']) ?>"> <input type="number" id="size" placeholder="<?= $loc['placeholder_pixels'] ?>" name="size" required="" min="1" max="4096" value="<?= htmlspecialchars($params['size']) ?>">
<datalist id="sizes">
<option value="128">
<option value="256">
<option value="512">
<option value="1024">
</datalist>
</div> </div>
</div> </div>
@ -257,6 +245,8 @@ if ($validFormSubmitted) {
$dataUri = $result->getDataUri(); $dataUri = $result->getDataUri();
$qrSize = $params['size'] + 2 * $params['margin'];
?> ?>
<section id="output"> <section id="output">