diff --git a/crates/bl/src/fetch.rs b/crates/bl/src/fetch.rs index db35375..53b560d 100644 --- a/crates/bl/src/fetch.rs +++ b/crates/bl/src/fetch.rs @@ -141,7 +141,10 @@ pub async fn fetch_photo_thumbnail( .ok_or_eyre("Thumbnail artifact is missing contents")?; use base64::prelude::*; - let data = BASE64_STANDARD.encode(&thumbnail_artifact_content); + let data = format!( + "data:image/png;base64,{}", + BASE64_STANDARD.encode(&thumbnail_artifact_content) + ); Ok(Some(PhotoThumbnailDisplayParams { data, diff --git a/crates/core_types/src/photo.rs b/crates/core_types/src/photo.rs index 8727e98..c088cd4 100644 --- a/crates/core_types/src/photo.rs +++ b/crates/core_types/src/photo.rs @@ -111,7 +111,7 @@ pub enum PhotoGroupStatus { /// The display parameters for a photo thumbnail. Not a table. #[derive(Clone, Debug, Deserialize, Serialize)] pub struct PhotoThumbnailDisplayParams { - /// The base64-encoded image data. + /// The base64-encoded image data, with the `data:image...` prefix. pub data: String, /// The alt text for the image. pub alt: String, diff --git a/crates/site-app/src/components/photo.rs b/crates/site-app/src/components/photo.rs index 4297419..9ddf062 100644 --- a/crates/site-app/src/components/photo.rs +++ b/crates/site-app/src/components/photo.rs @@ -41,10 +41,8 @@ pub fn Photo( #[prop(default = "rounded-box")] rounded: &'static str, #[prop(default = "")] extra_class: &'static str, ) -> impl IntoView { - let photo = create_resource( - move || (), - move |_| bl::fetch::fetch_photo_thumbnail(photo_id), - ); + let photo = + create_resource(move || photo_id, bl::fetch::fetch_photo_thumbnail); view! { @@ -52,7 +50,7 @@ pub fn Photo( Some(Ok(Some(photo))) => { Some(view! { {photo.alt} diff --git a/fly.toml b/fly.toml index 5b1fba5..c9e2b68 100644 --- a/fly.toml +++ b/fly.toml @@ -12,6 +12,10 @@ kill_timeout = "5s" app = "site-server" surreal = "surreal start --log=info --auth --bind '[::]':8000 file:/data/srdb.db" +[[vm]] + memory = "1GB" + processes = ["app"] + [env] SURREAL_WS_URL = "picturepro-mono.internal:8000" # these are fine in plain text because surreal is not exposed