mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
..
This commit is contained in:
parent
36bad9c4ed
commit
dc371b782c
2 changed files with 34 additions and 38 deletions
|
|
@ -36,8 +36,7 @@ impl Image {
|
||||||
let (w, h) = (PREVIEW.max_width, PREVIEW.max_height);
|
let (w, h) = (PREVIEW.max_width, PREVIEW.max_height);
|
||||||
|
|
||||||
if img.width() > w || img.height() > h {
|
if img.width() > w || img.height() > h {
|
||||||
img.resize(w, h, FilterType::Triangle)
|
img.resize(w, h, FilterType::Triangle).save_with_format(cache, ImageFormat::Jpeg)?;
|
||||||
.save_with_format(cache, ImageFormat::Jpeg)?;
|
|
||||||
}
|
}
|
||||||
Ok::<(), Error>(())
|
Ok::<(), Error>(())
|
||||||
});
|
});
|
||||||
|
|
@ -47,10 +46,7 @@ impl Image {
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn cache(path: &Path) -> PathBuf {
|
pub fn cache(path: &Path) -> PathBuf {
|
||||||
format!(
|
format!("/tmp/yazi/{:x}", Md5::new_with_prefix(path.to_string_lossy().as_bytes()).finalize())
|
||||||
"/tmp/yazi/{:x}",
|
|
||||||
Md5::new_with_prefix(path.to_string_lossy().as_bytes()).finalize()
|
|
||||||
)
|
|
||||||
.into()
|
.into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue