Add image segment
This commit is contained in:
parent
afe9b3c869
commit
99eb75f758
4 changed files with 87 additions and 34 deletions
|
|
@ -4,7 +4,7 @@ use anyhow::Context;
|
|||
use axum::{
|
||||
extract::{Multipart, State},
|
||||
http::StatusCode,
|
||||
response::{IntoResponse, Redirect, Response},
|
||||
response::{IntoResponse, Response},
|
||||
};
|
||||
use image::ImageFormat;
|
||||
use serde::Serialize;
|
||||
|
|
@ -77,5 +77,5 @@ pub async fn post(server: State<Server>, mut multipart: Multipart) -> somehow::R
|
|||
.with_main_file(include_str!("main.typ"));
|
||||
|
||||
server.print_typst(typst).await;
|
||||
Ok(Redirect::to("image").into_response())
|
||||
Ok(().into_response())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,31 +0,0 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>TP: Image</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Upload an image</h1>
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
<ol>
|
||||
<li><input type="file" name="image" /></li>
|
||||
<li>
|
||||
<label><input type="checkbox" name="bright" checked /> Bright</label>
|
||||
</li>
|
||||
<li>
|
||||
Dithering algorithm:
|
||||
<select name="algo">
|
||||
<option value="floyd-steinberg">Floyd-Steinberg</option>
|
||||
<option value="stucki">Stucki</option>
|
||||
</select>
|
||||
</li>
|
||||
<li>
|
||||
Scale:
|
||||
<input name="scale" type="number" min="1" max="8" value="1" />
|
||||
</li>
|
||||
<li><button>Print!</button></li>
|
||||
</ol>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue