Skip to content

Commit

Permalink
Update image_loader.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
rustbasic authored Nov 6, 2024
1 parent 34f1b3c commit d56fd6b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion crates/egui_extras/src/loaders/image_loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use egui::{
ColorImage,
};
use image::ImageFormat;
use std::{mem::size_of, sync::Arc};
use std::{mem::size_of, path::Path, sync::Arc};

type Entry = Result<Arc<ColorImage>, String>;

Expand All @@ -19,6 +19,11 @@ impl ImageCrateLoader {
}

fn is_supported_uri(uri: &str) -> bool {
let Some(ext) = Path::new(uri).extension().and_then(|ext| ext.to_str()) else {
// `true` because if there's no extension, assume that we support it
return true;
};

// Uses only the enabled image crate features
ImageFormat::all()
.filter(ImageFormat::reading_enabled)
Expand Down

0 comments on commit d56fd6b

Please sign in to comment.