fix image preview

This commit is contained in:
Julian Freeman
2026-03-22 15:46:13 -04:00
parent e3cba2a6ba
commit 7a82f3fb81
6 changed files with 36 additions and 11 deletions

View File

@@ -24,6 +24,14 @@ pub fn get_pause_state(state: tauri::State<'_, AppState>) -> bool {
state.is_paused.load(Ordering::SeqCst)
}
use base64::{engine::general_purpose, Engine as _};
#[tauri::command]
pub fn get_image_base64(path: String) -> Result<String, String> {
let bytes = fs::read(path).map_err(|e| e.to_string())?;
Ok(general_purpose::STANDARD.encode(bytes))
}
#[tauri::command]
pub fn get_timeline(date: String, base_dir: String) -> Vec<serde_json::Value> {
let mut results = Vec::new();

View File

@@ -19,7 +19,8 @@ pub fn run() {
.invoke_handler(tauri::generate_handler![
engine::toggle_pause,
engine::get_pause_state,
engine::get_timeline
engine::get_timeline,
engine::get_image_base64
])
.setup(|app| {
app.manage(engine::AppState {