return image size so the client side can determine whether to crop or not
This commit is contained in:
@@ -101,22 +101,23 @@ pub fn load_image(image_base64: String) -> String {
|
||||
Ok(image) => {
|
||||
match image::load_from_memory(image.as_ref()) {
|
||||
Ok(image) => {
|
||||
let size = format!("{}×{}", image.width(), image.height());
|
||||
// todo get rid of magic numbers! what about Bitsy HD?
|
||||
let image = image.resize(128, 128, CatmullRom);
|
||||
state.image = Some(image);
|
||||
"OK"
|
||||
size
|
||||
},
|
||||
_ => {
|
||||
state.image = None;
|
||||
"Couldn't load image"
|
||||
"Couldn't load image".to_string()
|
||||
}
|
||||
}
|
||||
},
|
||||
_ => {
|
||||
state.image = None;
|
||||
"Couldn't decode image"
|
||||
"Couldn't decode image".to_string()
|
||||
}
|
||||
}.to_string()
|
||||
}
|
||||
}
|
||||
|
||||
#[wasm_bindgen]
|
||||
|
||||
Reference in New Issue
Block a user