diff --git a/package.json b/package.json index f551208..2f0eea5 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "lodash.take": "^4.1.1", "lucide-react": "^0.295.0", "luxon": "^3.3.0", - "next": "^14.0.4", + "next": "*", "next-sitemap": "^4.1.8", "next-themes": "^0.2.1", "radix-ui": "^1.0.1", diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index fe1b1f3..72ffaf2 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -878,6 +878,7 @@ dependencies = [ "fs_extra", "fuzzy-matcher", "ignore", + "imagesize", "include_dir", "libc", "local-ip-address", @@ -1582,6 +1583,12 @@ dependencies = [ "num-traits", ] +[[package]] +name = "imagesize" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "029d73f573d8e8d63e6d5020011d3255b28c3ba85d6cf870a07184ed23de9284" + [[package]] name = "include_dir" version = "0.7.3" @@ -2022,9 +2029,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.17" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index b67e6f4..2be35e1 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -34,7 +34,7 @@ tauri = { version = "1.5.4", features = ["devtools", "fs-read-file", "os-all", " serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" rayon="1.7.0" -# image = "0.24.6" +# image = "0.25.1" # image = {git="https://codeberg.org/visnk/image-rs.git"} reqwest="0.11.24" tokio= {version="1.36.0",features= ["macros"] } @@ -49,6 +49,7 @@ rustc-hash="1.1.0" # walkdir="2.3.3" filesize = "0.2.0" # jwalk="0.8.1" +imagesize="0.12.0" # dua-cli="2.19.2" # dirscan="1.4.1" # markdown= {git="https://github.com/wooorm/markdown-rs.git"} diff --git a/src-tauri/src/fileitem.rs b/src-tauri/src/fileitem.rs index 70c139b..87b8006 100644 --- a/src-tauri/src/fileitem.rs +++ b/src-tauri/src/fileitem.rs @@ -16,7 +16,7 @@ use std::os::windows::fs::OpenOptionsExt; // use image::{GenericImageView, io::Reader}; use rayon::prelude::*; use serde_json::json; -use tauri::{Manager, State, Window}; +use tauri::{api::file, Manager, State, Window}; // use walkdir::{WalkDir, DirEntry}; use crate::{ @@ -88,12 +88,26 @@ pub fn populatefileitem( let is_dir = fs::metadata(path).map(|m| m.is_dir()).unwrap_or(false); // check if folder let mut folderloc = 0; let mut filetype = "Folder".to_string(); + let mut filedime=String::new(); // let mut filesetcollection=HashSet::new(); let issymlink = path.is_relative() || path.is_symlink(); if (issymlink) { filetype += "symlink"; } if !path.is_dir() { + #[cfg(unix)] + if let Ok(img) = + imagesize::size(path) + // image::image_dimensions(path) + // reader.into_dimensions() + { + + println!("image found"); + // let (width, height) = img; + filedime= format!("{} x {}", img.width, img.height).to_string(); + println!("{}",filedime); + // println!("{filedime}") + } //modify here to add more extensions to list linecount match (path.extension()) { Some(g) => { @@ -123,8 +137,10 @@ pub fn populatefileitem( .open(path) .unwrap(), ); + println!("image found"); + // #[cfg(unix)] - // let f = + // let f = // BufReader::new( // OpenOptions::new() @@ -134,15 +150,16 @@ pub fn populatefileitem( // .open(path).unwrap()); // let mut reader = image::io::Reader::new(f); - // // println!("image found"); + // if let Ok(img) = // // image::image_dimensions(path) // reader.into_dimensions() // { + // println!("image found"); // let (width, height) = img; - // filedime= - // format!("{} x {}", width, height).to_string(); + // filedime= format!("{} x {}", width, height).to_string(); + // println!("{}",filedime); // // println!("{filedime}") // } } @@ -174,7 +191,7 @@ pub fn populatefileitem( let tr; let (lmdate, timestamp) = lastmodified(&pathtf); FileItem { - name: name.clone(), + name: name.clone()+" "+&filedime, path: pathtf.clone(), is_dir, size: {