@@ -43,7 +43,7 @@ pnpm install qwik-image
4343
4444## Usage
4545
46- ### Global Provider
46+ ### Global Provider (required)
4747
4848```
4949const imageTransformer$ = $(({ src, width, height }: ImageTransformerProps): string => {
@@ -52,7 +52,9 @@ const imageTransformer$ = $(({ src, width, height }: ImageTransformerProps): str
5252
5353// Provide your default options
5454useImageProvider({
55- resolutions: [640], <-- You can set this prop to overwrite default values [3840, 1920, 1280, 960, 640]
55+ // you can set this property to overwrite default values [640, 960, 1280, 1920, 3840]
56+ resolutions: [640],
57+ // you we can define the source from which to load our image
5658 imageTransformer$,
5759});
5860```
@@ -62,6 +64,7 @@ useImageProvider({
6264```
6365<Image
6466 layout="fixed"
67+ objectFit="cover"
6568 width="300"
6669 height="300"
6770 src={...}
@@ -70,20 +73,45 @@ useImageProvider({
7073/>
7174```
7275
73- ## placeholder property values:
76+ ## loading values:
77+
78+ Here is the loading values and behaviors https://developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/loading
79+ default: ` lazy `
80+
81+ ## layout values:
82+
83+ ### ` constrained `
84+ If the width of the image is larger than the screen, the screen size is taken, otherwise the actual image size is kept
85+
86+ ### ` fixed `
87+ regardless of the screen width, the width of the image is kept
88+
89+ ### ` fullWidth `
90+ the width of the image is always equal to the width of the screen
91+
92+ ## objectFit values:
93+
94+ Here is the objectFit values and behaviors https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit
95+ default: ` cover `
96+
97+ ## placeholder values:
98+
99+ You can define a placeholder to wait for the image to load.
100+ default: ` transparent `
74101
75102#### ` background: 'rgba(37,99,235,1)'; `
76103
77- <img width =" 312 " alt =" background " src =" https://user-images.githubusercontent.com/35845425/223715512-d097de71-09a8-4e55-aa54-f59850e0a3a3 .png" >
104+ <img width =" 320 " alt =" placeholder-1 " src =" ./assets/placeholder-1 .png" >
78105
79106#### ` background: 'linear-gradient(180deg, rgba(2,0,36,1) 0%, rgba(166,206,247,1) 0%, rgba(37,99,235,1) 83%);'; `
80107
81- <img width =" 312 " alt =" linear-gradient " src =" https://user-images.githubusercontent.com/35845425/223715243-a058998c-f2c3-4811-b15d-344d3fd3a891 .png" >
108+ <img width =" 320 " alt =" placeholder-2 " src =" ./assets/placeholder-2 .png" >
82109
83110#### ` background: 'url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNUTX59BgAEaQJBWyqr7QAAAABJRU5ErkJggg==")'; `
84111
85- <img width =" 312 " alt =" url-data-image " src =" https://user-images.githubusercontent.com/35845425/223958138-bdb0f110-460b-4fb3-a114-e7b9d63c12b6.png " >
112+ <img width =" 320 " alt =" placeholder-3 " src =" ./assets/placeholder-3.png " >
113+
86114
87115#### ` background: 'url("/public/placeholder.jpg") no-repeat center / cover'; `
88116
89- <img width =" 312 " alt =" url-jpg " src =" https://user-images.githubusercontent.com/35845425/223715374-ea5a41fa-a7df-42e1-af1b-2c0322608397 .png" >
117+ <img width =" 320 " alt =" placeholder-4 " src =" ./assets/placeholder-4 .png" >
0 commit comments