Enable thumbnail support for webp images (#1634)

* Enable thumbnail support for webp images

* Remove webp optional dep from sd-images crate
This commit is contained in:
Vítor Vasconcellos 2023-10-20 00:33:55 -03:00 committed by GitHub
parent 0f3d7a2a64
commit b827f9cc66
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 5 deletions

1
Cargo.lock generated
View file

@ -6907,7 +6907,6 @@ dependencies = [
"specta",
"thiserror",
"tracing 0.2.0",
"webp",
]
[[package]]

View file

@ -14,7 +14,6 @@ heif = ["dep:libheif-rs", "dep:libheif-sys"]
[dependencies]
image = "0.24.7"
webp = { version = "0.2.6", optional = true }
thiserror = "1.0.49"
resvg = "0.36.0"
rspc = { workspace = true, optional = true } # error conversion

View file

@ -11,9 +11,9 @@ pub const MAXIMUM_FILE_SIZE: u64 = MIB * 192;
/// These are roughly all extensions supported by the `image` crate, as of `v0.24.7`.
///
/// We only support images that have both good encoding and decoding support, without external C-based dependencies (e.g. `avif`)
pub const GENERIC_EXTENSIONS: [&str; 16] = [
pub const GENERIC_EXTENSIONS: [&str; 17] = [
"bmp", "dib", "ff", "gif", "ico", "jpg", "jpeg", "png", "pnm", "qoi", "tga", "icb", "vda",
"vst", "tiff", "tif",
"vst", "tiff", "tif", "webp",
];
pub const SVG_EXTENSIONS: [&str; 2] = ["svg", "svgz"];
pub const PDF_EXTENSIONS: [&str; 1] = ["pdf"];
@ -67,6 +67,7 @@ pub enum ConvertableExtension {
Svg,
Svgz,
Pdf,
Webp,
}
impl Display for ConvertableExtension {
@ -107,6 +108,7 @@ impl TryFrom<String> for ConvertableExtension {
"svg" => Ok(Self::Svg),
"svgz" => Ok(Self::Svgz),
"pdf" => Ok(Self::Pdf),
"webp" => Ok(Self::Webp),
_ => Err(crate::Error::Unsupported),
}
}

View file

@ -140,7 +140,7 @@ export type Composite = "Unknown" | "False" | "General" | "Live"
export type ConvertImageArgs = { location_id: number; file_path_id: number; delete_src: boolean; desired_extension: ConvertableExtension; quality_percentage: number | null }
export type ConvertableExtension = "bmp" | "dib" | "ff" | "gif" | "ico" | "jpg" | "jpeg" | "png" | "pnm" | "qoi" | "tga" | "icb" | "vda" | "vst" | "tiff" | "tif" | "heif" | "heifs" | "heic" | "heics" | "avif" | "avci" | "avcs" | "svg" | "svgz" | "pdf"
export type ConvertableExtension = "bmp" | "dib" | "ff" | "gif" | "ico" | "jpg" | "jpeg" | "png" | "pnm" | "qoi" | "tga" | "icb" | "vda" | "vst" | "tiff" | "tif" | "heif" | "heifs" | "heic" | "heics" | "avif" | "avci" | "avcs" | "svg" | "svgz" | "pdf" | "webp"
export type CreateEphemeralFolderArgs = { path: string; name: string | null }