Use non-filling resize on server side. Client does filling.

This commit is contained in:
2020-02-23 08:46:20 -08:00
parent 792471bf00
commit 7ec3a11037
3 changed files with 39 additions and 3 deletions

View File

@@ -73,6 +73,7 @@ fn album(lib: Library, id: String) -> Result<impl warp::Reply, warp::Rejection>
struct ImageParams {
w: Option<u32>,
h: Option<u32>,
fill: Option<bool>,
}
fn image(
@@ -81,7 +82,11 @@ fn image(
params: ImageParams,
) -> Result<impl warp::Reply, warp::Rejection> {
// TODO(wathiede): add caching headers.
match lib.thumbnail(&media_items_id, (params.w, params.h)) {
match lib.thumbnail(
&media_items_id,
(params.w, params.h),
params.fill.unwrap_or(false),
) {
None => {
warn!("Couldn't find original {}", &media_items_id);
Err(warp::reject::not_found())