This commit is contained in:
Gavin McDonald
2025-05-15 08:02:51 -04:00
3 changed files with 93 additions and 18 deletions

View File

@@ -21,7 +21,7 @@ ARG RUNNER_IMAGE="debian:${DEBIAN_VERSION}"
FROM ${BUILDER_IMAGE} AS builder FROM ${BUILDER_IMAGE} AS builder
# install build dependencies # install build dependencies
RUN apt-get update -y && apt-get install -y build-essential git imagemagick fonts-dejavu fonts-liberation fonts-freefont-ttf \ RUN apt-get update -y && apt-get install -y build-essential git imagemagick ttf-mscorefonts-installer \
&& apt-get clean && rm -f /var/lib/apt/lists/*_* && apt-get clean && rm -f /var/lib/apt/lists/*_*
# Debian version still uses 'convert' # Debian version still uses 'convert'
@@ -71,7 +71,7 @@ RUN mix release
FROM ${RUNNER_IMAGE} FROM ${RUNNER_IMAGE}
RUN apt-get update -y && \ RUN apt-get update -y && \
apt-get install -y libstdc++6 openssl libncurses5 locales ca-certificates imagemagick fonts-dejavu fonts-liberation fonts-freefont-ttf \ apt-get install -y libstdc++6 openssl libncurses5 locales ca-certificates imagemagick ttf-mscorefonts-installer \
&& apt-get clean && rm -f /var/lib/apt/lists/*_* && apt-get clean && rm -f /var/lib/apt/lists/*_*
# Debian version still uses 'convert' # Debian version still uses 'convert'
@@ -86,8 +86,10 @@ ENV LC_ALL=en_US.UTF-8
WORKDIR "/app" WORKDIR "/app"
# configure the directory for generated images
# probably need some better permissions here
RUN mkdir -p /app/_build/prod/lib/labelmaker/priv/static/labels RUN mkdir -p /app/_build/prod/lib/labelmaker/priv/static/labels
RUN chmod -R 775 /app/_build/prod/lib/labelmaker/priv/static/labels RUN chmod -R 777 /app/_build/prod/lib/labelmaker/priv/static/labels
RUN chown nobody /app RUN chown nobody /app

View File

@@ -1,18 +1,91 @@
# Labelmaker # Labelmaker
To start your Phoenix server: [Labelmaker](https://labelmaker.xyz) is a simple web tool for generating text-based images, perfect for creating decals in [Tabletop Simulator](https://www.tabletopsimulator.com/). Just append your desired text to the URL and Labelmaker will return an image, no design tools required.
* Run `mix setup` to install and setup dependencies ## ✨ Features
* Start Phoenix endpoint with `mix phx.server` or inside IEx with `iex -S mix phx.server`
Now you can visit [`localhost:4000`](http://localhost:4000) from your browser. - 📦 Instant text-to-image conversion via URL
- 🎨 Customizable `color`, `outline`, `font`, and `size` via query string
- 🧩 Designed for ease of use with Tabletop Simulator
- 🧭 Interactive homepage to preview available options
Ready to run in production? Please [check our deployment guides](https://hexdocs.pm/phoenix/deployment.html). ## 🚀 Usage
## Learn more ### Basic Label
* Official website: https://www.phoenixframework.org/ [https://labelmaker.xyz/Hello World](https://labelmaker.xyz/Hello%20World)
* Guides: https://hexdocs.pm/phoenix/overview.html
* Docs: https://hexdocs.pm/phoenix Generates an image of "Hello World" in the default style.
* Forum: https://elixirforum.com/c/phoenix-forum
* Source: https://github.com/phoenixframework/phoenix ![Hello World](https://labelmaker.xyz/Hello%20World?outline=white)
### Set Text Color
[https://labelmaker.xyz/Hello?color=yellow](https://labelmaker.xyz/Hello?color=yellow)
Renders "Hello" in yellow text.
![Yellow Hello](https://labelmaker.xyz/Hello?color=yellow)
### Add Outline
[https://labelmaker.xyz/Hello?color=yellow&outline=black](https://labelmaker.xyz/Hello?color=yellow&outline=black)
Renders "Hello" in yellow with a black outline, perfect for contrast on similar backgrounds.
![Outlined yellow Hello](https://labelmaker.xyz/Hello?color=yellow&outline=black)
### Customize Font and Size
[https://labelmaker.xyz/Courier?font=Courier&size=96&color=CornFlowerBlue&outline=white](https://labelmaker.xyz/Courier?font=Courier&size=96&color=CornFlowerBlue&outline=white)
Uses the `Courier` font at 96px size.
![CornflowerBlue Courier](https://labelmaker.xyz/Courier?font=Courier&size=72&color=CornflowerBlue&outline=white)
### Multiple Lines
[https://labelmaker.xyz/Multiple\nLines?font=DejaVu-Sans-Oblique&color=orange](https://labelmaker.xyz/Multiple\nLines?font=DejaVu-Sans-Oblique&color=orange)
Use `\n` to insert line breaks.
![Multiple\nLines](https://labelmaker.xyz/Multiple\nLines?font=DejaVu-Sans-Oblique&size=72&color=orange)
## ⚙️ Query Parameters
| Parameter | Description | Example Value |
| --------- | ------------------- | ----------------------- |
| `color` | Text color | `red`, `CornFlowerBlue` |
| `outline` | Outline color | `black`, `white` |
| `font` | Font name | `Courier`, `Helvetica` |
| `size` | Font size in pixels | `24`, `48` |
## 🧪 Try It Live
Visit the [Labelmaker homepage](https://labelmaker.xyz/) to:
- Preview fonts and colors
- Test out combinations
- Copy generated URLs for use in Tabletop Simulator or elsewhere
## 🧰 Development
This project is powered by Elixir + Phoenix, employs ImageMagick to create the images, and uses Docker for deployment.
### Build & Run Locally
```sh
mix setup
mix phx.server
```
Or use Docker:
```sh
docker build -t labelmaker .
docker run -p 4000:4000 labelmaker
```
```
```

View File

@@ -4,8 +4,8 @@ defmodule LabelmakerWeb.Constants do
link: "", link: "",
font: "Helvetica", font: "Helvetica",
color: "black", color: "black",
outline: "white", outline: "none",
size: "32" size: "72"
} }
@preview %{ @preview %{
@@ -42,9 +42,9 @@ defmodule LabelmakerWeb.Constants do
@outlines ~w(none white black gray) @outlines ~w(none white black gray)
@sizes 8..72 @sizes 16..128
|> Enum.to_list() |> Enum.to_list()
|> Enum.take_every(4) |> Enum.take_every(8)
|> Enum.map(&Integer.to_string/1) |> Enum.map(&Integer.to_string/1)
def colors, do: @colors def colors, do: @colors