File tree 1 file changed +6
-27
lines changed
1 file changed +6
-27
lines changed Original file line number Diff line number Diff line change @@ -124,33 +124,12 @@ fn process_image(
124
124
min_aspect_ratio : Option < f32 > ,
125
125
) -> Result < ( bytes:: Bytes , String ) , ImageError > {
126
126
match content_type {
127
- "image/gif" => {
128
- if target_width. is_none ( ) && min_aspect_ratio. is_none ( ) {
129
- process_animated_image (
130
- image_bytes,
131
- content_type,
132
- target_width,
133
- min_aspect_ratio,
134
- )
135
- } else {
136
- // Skip animated image processing for GIFs that won't be modified
137
- // But not before checking if it's indeed a GIF
138
- let format = image:: guess_format ( & image_bytes) ?;
139
- if format == ImageFormat :: Gif {
140
- Ok ( ( image_bytes. clone ( ) , "gif" . to_string ( ) ) )
141
- } else {
142
- Err ( ImageError :: Unsupported (
143
- UnsupportedError :: from_format_and_kind (
144
- ImageFormat :: Gif . into ( ) ,
145
- UnsupportedErrorKind :: GenericFeature (
146
- "Attempted to process an invalid GIF!"
147
- . to_owned ( )
148
- ) ,
149
- ) ,
150
- ) )
151
- }
152
- }
153
- }
127
+ "image/gif" => process_animated_image (
128
+ image_bytes,
129
+ content_type,
130
+ target_width,
131
+ min_aspect_ratio,
132
+ ) ,
154
133
"image/png" => {
155
134
let decoder = PngDecoder :: new ( Cursor :: new ( image_bytes. clone ( ) ) ) ?;
156
135
if decoder. is_apng ( ) ? {
You can’t perform that action at this time.
0 commit comments