Add rotate checkbox for xkcd
This commit is contained in:
parent
b0f1828723
commit
2f9472b803
2 changed files with 9 additions and 1 deletions
|
|
@ -6,7 +6,7 @@ use axum::{
|
|||
extract::State,
|
||||
response::{IntoResponse, Response},
|
||||
};
|
||||
use image::ImageFormat;
|
||||
use image::{ImageFormat, imageops};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::server::{Server, somehow};
|
||||
|
|
@ -31,6 +31,7 @@ struct Data {
|
|||
#[derive(Deserialize)]
|
||||
pub struct FormData {
|
||||
pub number: Option<u32>,
|
||||
pub rotate: Option<bool>,
|
||||
pub dither: Option<bool>,
|
||||
pub bright: Option<bool>,
|
||||
pub feed: Option<bool>,
|
||||
|
|
@ -59,6 +60,10 @@ pub async fn post(server: State<Server>, Form(form): Form<FormData>) -> somehow:
|
|||
feed: form.feed.unwrap_or(true),
|
||||
};
|
||||
|
||||
if form.rotate.unwrap_or(false) {
|
||||
image = imageops::rotate90(&image);
|
||||
}
|
||||
|
||||
if data.dither {
|
||||
let max_width = Some(384);
|
||||
let max_height = Some(1024);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue