summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Weipert <git@mail.dweipert.de>2025-08-26 22:34:08 +0200
committerDaniel Weipert <git@mail.dweipert.de>2025-08-26 22:34:08 +0200
commitb770974924e82247ac002f04bc0c847b314486e0 (patch)
treee93c7ce41cf3e75bc8a0c733f5a0da2dee9ee505
parent3e937cadee223247dc91d86a73803f33472bf15d (diff)
add settings to change unrounded corners
-rw-r--r--docker-compose.dev.yml2
-rw-r--r--print/print.php12
-rw-r--r--web/index.php16
3 files changed, 24 insertions, 6 deletions
diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml
index b08d9bf..7fe8fe0 100644
--- a/docker-compose.dev.yml
+++ b/docker-compose.dev.yml
@@ -24,8 +24,6 @@ services:
- "php"
ports:
- "8080:80"
- environment:
- - "SERVER_NAME=localhost"
volumes:
- "./web:/var/www/html"
- "./print:/var/www/html/print"
diff --git a/print/print.php b/print/print.php
index 0e1137f..e4cc759 100644
--- a/print/print.php
+++ b/print/print.php
@@ -8,6 +8,9 @@ if (empty($decklist)) {
die('No decklist provided.');
}
+$useUnroundedCorners = $_ENV['USE_UNROUNDED_CORNERS'] ?? true;
+$unroundedCornerColor = $_ENV['UNROUNDED_CORNER_COLOR'] ?? '#000';
+
require_once __DIR__ . '/vendor/autoload.php';
/*
@@ -90,6 +93,11 @@ if (empty($images)) {
* Build HTML
*/
+$imgBackgroundColor = '';
+if ($useUnroundedCorners) {
+ $imgBackgroundColor = "background-color: {$unroundedCornerColor};";
+}
+
$template = <<<HTML
<html>
<head>
@@ -103,8 +111,8 @@ $template = <<<HTML
width: 2.49in;
height: 3.48in;
display: block;
- background-color: #16130e;
- background-color: #000;
+ /*background-color: #16130e;*/
+ $imgBackgroundColor;
}
#bg {
diff --git a/web/index.php b/web/index.php
index 2aec31f..5c5b7af 100644
--- a/web/index.php
+++ b/web/index.php
@@ -2,6 +2,8 @@
if (isset($_POST['decklist'])) {
$_ENV['DECKLIST'] = $_POST['decklist'];
+ $_ENV['USE_UNROUNDED_CORNERS'] = isset($_POST['use_unrounded_corners']);
+ $_ENV['UNROUNDED_CORNER_COLOR'] = $_POST['unrounded_corner_color'];
include __DIR__ . '/print/print.php';
exit;
}
@@ -29,8 +31,18 @@ PLCHLDR;
</head>
<body>
<form action="" method="POST">
- <textarea name="decklist" placeholder="<?php echo $placeholder; ?>" rows="10" cols="40" style="max-width: 100%;" required></textarea>
- <button>Submit</button>
+ <div>
+ <textarea name="decklist" placeholder="<?php echo $placeholder; ?>" rows="10" cols="40" style="max-width: 100%;" required></textarea>
+ </div>
+ <div>
+ <label>Use Unrounded Corners <input type="checkbox" name="use_unrounded_corners" value="1"></label>
+ </div>
+ <div>
+ <label>Unrounded Corner Color <input type="color" name="unrounded_corner_color"></label>
+ </div>
+ <div>
+ <button style="width: 100%; min-height: 4rem;">Submit</button>
+ </div>
</form>
<hr>
<a href="https://git.dweipert.de/mtg-pdf">Source</a>