File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,21 +14,21 @@ jobs:
1414 format :
1515 runs-on : ubuntu-latest
1616 steps :
17- - uses : actions/checkout@v3
17+ - uses : actions/checkout@v4
1818 - run : cargo fmt --all -- --check
1919
2020 # no cache needed for cargo outdated
2121 outdated :
2222 runs-on : ubuntu-latest
2323 steps :
24- - uses : actions/checkout@v3
25- - run : cargo install cargo-outdated
24+ - uses : actions/checkout@v4
25+ - run : cargo install --locked cargo-outdated
2626 - run : cargo outdated --exit-code 1
2727
2828 build :
2929 runs-on : ubuntu-latest
3030 steps :
31- - uses : actions/checkout@v3
31+ - uses : actions/checkout@v4
3232 - uses : Swatinem/rust-cache@v2
3333 with :
3434 prefix-key : cargo
3838 clippy :
3939 runs-on : ubuntu-latest
4040 steps :
41- - uses : actions/checkout@v3
41+ - uses : actions/checkout@v4
4242 - uses : Swatinem/rust-cache@v2
4343 with :
4444 prefix-key : cargo
4848 test :
4949 runs-on : ubuntu-latest
5050 steps :
51- - uses : actions/checkout@v3
51+ - uses : actions/checkout@v4
5252 - uses : Swatinem/rust-cache@v2
5353 with :
5454 prefix-key : cargo
Original file line number Diff line number Diff line change 22
33Easy-to-use library to create image thumbnails from images existing on some (cloud) object storage or from disk.
44
5- Currently implemented is a connection to Google Cloud Storage, but it can be easily extended to other providers .
5+ Works with any storage provider that is supported by [ ` object_store ` ] ( https://crates.io/crates/object_store ) .
66
77## Supported formats
88PNG and JPEG are currently the only supported image formats.
@@ -28,7 +28,6 @@ thumbs:
2828
2929## Google credentials
3030This crate relies on [object_store](https://crates.io/crates/object_store) for the interaction with the storage backend.
31- Currently, this crate only supports Google Cloud Storage and AWS S3.
3231
3332To configure the Google Service Account, use one of the following environment variables as
3433[described in the object_store](https://docs.rs/object_store/latest/object_store/gcp/struct.GoogleCloudStorageBuilder.html#method.from_env)
Original file line number Diff line number Diff line change 11use image:: ImageFormat ;
2+ use object_store:: ObjectStore ;
23use object_store:: path:: Path ;
34use serde:: Deserialize ;
45use std:: sync:: Arc ;
@@ -10,6 +11,18 @@ pub struct ImageThumbs<T> {
1011 pub ( crate ) settings : Arc < Vec < Params > > ,
1112}
1213
14+ impl < T > ImageThumbs < T > {
15+ pub fn with_store ( object_store : T , settings : Vec < Params > ) -> Self
16+ where
17+ T : ObjectStore ,
18+ {
19+ Self {
20+ client : Arc :: new ( RwLock :: new ( object_store) ) ,
21+ settings : Arc :: new ( settings) ,
22+ }
23+ }
24+ }
25+
1326impl < T > Clone for ImageThumbs < T > {
1427 fn clone ( & self ) -> Self {
1528 Self {
You can’t perform that action at this time.
0 commit comments