photosuite 0.4.0 → 0.6.0-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +316 -355
- package/README.zh-CN.md +322 -363
- package/demo/astro.config.mjs +19 -19
- package/demo/package.json +20 -20
- package/demo/postcss.config.cjs +3 -3
- package/demo/public/svg/github.svg +10 -10
- package/demo/src/content/index.md +23 -23
- package/demo/src/pages/index.astro +144 -144
- package/demo/src/styles.css +80 -80
- package/demo/src/theme.css +42 -42
- package/demo/tsconfig.json +5 -5
- package/dist/dom-CbWZS_z2.js +62 -0
- package/dist/dom-DHeT_BPX.cjs +1 -0
- package/dist/{exif-By4dnrsZ.js → exif-CZ_ZkRfZ.js} +1 -1
- package/dist/exif-TmasenQH.cjs +1 -0
- package/dist/{imageAlts-CXeoiP7r.js → imageAlts-BsnKp4WR.js} +1 -1
- package/dist/imageAlts-D4k83Tai.cjs +1 -0
- package/dist/{imageGrid-B15ScI-V.js → imageGrid-AlLnFcYP.js} +4 -4
- package/dist/{imageGrid-W9f4Y7WX.cjs → imageGrid-HVOgPgGQ.cjs} +1 -1
- package/dist/integration.d.ts +1 -0
- package/dist/modules/dom.d.ts +11 -2
- package/dist/photosuite.cjs.js +1 -1
- package/dist/photosuite.es.js +1 -1
- package/dist/photosuite.integration.cjs +2 -2
- package/dist/photosuite.integration.js +195 -193
- package/dist/rehype/Container.d.ts +27 -0
- package/dist/types.d.ts +0 -14
- package/package.json +1 -1
- package/dist/dom-CVxYawCH.cjs +0 -1
- package/dist/dom-DmsrkMfO.js +0 -39
- package/dist/exif-PySbhvN7.cjs +0 -1
- package/dist/imageAlts-DaihHCP5.cjs +0 -1
package/README.md
CHANGED
|
@@ -1,356 +1,317 @@
|
|
|
1
|
-
<div align="center">
|
|
2
|
-
<a href="/">
|
|
3
|
-
<img src="/public/logo.svg" alt="Photosuite" width="120" />
|
|
4
|
-
<br/>
|
|
5
|
-
<h1>Photosuite</h1>
|
|
6
|
-
</a>
|
|
7
|
-
|
|
8
|
-
<p>
|
|
9
|
-
<a href="https://photosuite.lhasa.icu">Official Website</a> •
|
|
10
|
-
<a href="https://github.com/achuanya/photosuite/releases">Latest Release</a> •
|
|
11
|
-
<a href="https://github.com/achuanya/photosuite/blob/main/Changelog.md">Changelog</a> •
|
|
12
|
-
<a href="./README.zh-CN.md">简体中文</a>
|
|
13
|
-
</p>
|
|
14
|
-
</div>
|
|
15
|
-
|
|
16
|
-
Photosuite is a simple yet feature-rich image integration tailored for independent blogs. It modularly integrates lightbox, EXIF data, path resolution, image grid, and more into a single, zero-config package. Out of the box, no tedious configuration required—give your blog images a fresh look with just one line of code!
|
|
17
|
-
|
|
18
|
-
## Features
|
|
19
|
-
|
|
20
|
-
* **Lightbox**: Customized Fancybox integration, minimalist and practical.
|
|
21
|
-
* **Static EXIF**: Integrated `exiftool-vendored.js` supporting custom EXIF parameters.
|
|
22
|
-
* **Path Resolution**: Just insert the filename, and the path is auto-resolved at build time.
|
|
23
|
-
* **Captions**: Automatically displays image `alt` attributes as captions.
|
|
24
|
-
* **Image Grid**: Automatically groups consecutive images (2-3) into a grid layout, each independently clickable.
|
|
25
|
-
* **Extreme Performance**: All features are purely static, processed at build time, runtime dependency-free, modular, and loaded on demand.
|
|
26
|
-
* **Zero-Config**: Default settings satisfy most needs, with rich options for deep customization.
|
|
27
|
-
|
|
28
|
-
## Installation
|
|
29
|
-
|
|
30
|
-
```bash
|
|
31
|
-
pnpm add photosuite
|
|
32
|
-
# or
|
|
33
|
-
npm install photosuite
|
|
34
|
-
# or
|
|
35
|
-
yarn add photosuite
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
## Quick Start
|
|
39
|
-
|
|
40
|
-
Integrating Photosuite with Astro is very simple, just add the following configuration to `astro.config.js`:
|
|
41
|
-
|
|
42
|
-
```javascript
|
|
43
|
-
import { defineConfig } from 'astro/config';
|
|
44
|
-
import photosuite from 'photosuite';
|
|
45
|
-
import "photosuite/dist/photosuite.css";
|
|
46
|
-
|
|
47
|
-
export default defineConfig({
|
|
48
|
-
integrations: [
|
|
49
|
-
photosuite({
|
|
50
|
-
// [Required] Specify the CSS selector for the scope
|
|
51
|
-
// Recommended: Your content container to avoid affecting other parts of the site. Supports multiple selectors separated by commas.
|
|
52
|
-
scope: '#main',
|
|
53
|
-
})
|
|
54
|
-
]
|
|
55
|
-
});
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
Once configured, Photosuite will automatically process all images within your specified scope.
|
|
59
|
-
|
|
60
|
-
## Features & Configuration
|
|
61
|
-
|
|
62
|
-
### 1. Path Resolution
|
|
63
|
-
|
|
64
|
-
Managing image paths in blog posts can be tedious. Photosuite offers flexible resolution strategies that you can configure according to your needs.
|
|
65
|
-
|
|
66
|
-
**Scenario A: All images in a single domain/directory**
|
|
67
|
-
|
|
68
|
-
```javascript
|
|
69
|
-
photosuite({
|
|
70
|
-
scope: '#main',
|
|
71
|
-
imageBase: 'https://cdn.example.com/images/',
|
|
72
|
-
})
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
**Markdown Usage:**
|
|
76
|
-
```markdown
|
|
77
|
-

|
|
78
|
-
<!-- Resolves to: https://cdn.example.com/images/photo.jpg -->
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
**Scenario B: Separate image directory per post (Default)**
|
|
82
|
-
|
|
83
|
-
You can specify the directory name in the Frontmatter:
|
|
84
|
-
|
|
85
|
-
```yaml
|
|
86
|
-
---
|
|
87
|
-
title: My First GitHub PR
|
|
88
|
-
imageDir: "2025-11-26-my-first-github-pr"
|
|
89
|
-
---
|
|
90
|
-
|
|
91
|
-

|
|
92
|
-
<!-- Resolves to: https://cdn.example.com/images/2025-11-26-my-first-github-pr/photo.jpg -->
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
**Scenario C: Use filename as directory**
|
|
96
|
-
|
|
97
|
-
```javascript
|
|
98
|
-
photosuite({
|
|
99
|
-
scope: '#main',
|
|
100
|
-
imageBase: 'https://cdn.example.com/',
|
|
101
|
-
fileDir: true, // Enable this option
|
|
102
|
-
})
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
If your post filename is `2025-11-26-my-first-github-pr.md`, the image path automatically resolves to:
|
|
106
|
-
|
|
107
|
-
`https://cdn.example.com/images/2025-11-26-my-first-github-pr/photo.jpg`
|
|
108
|
-
|
|
109
|
-
### 2. EXIF Data Display
|
|
110
|
-
|
|
111
|
-
Photosuite uses `exiftool-vendored.js` to extract information at build time.
|
|
112
|
-
|
|
113
|
-
**Default Configuration:**
|
|
114
|
-
Default display: Camera Model, Lens Model, Focal Length, Aperture, Shutter Speed, ISO, Date Original.
|
|
115
|
-
|
|
116
|
-
> NIKON Z 30 · NIKKOR Z DX 16-50mm f/3.5-6.3 VR · 20.5 mm · ƒ/3.8 · 1/15 · ISO 1000 · 2025/12/9
|
|
117
|
-
|
|
118
|
-
**Custom Configuration:**
|
|
119
|
-
|
|
120
|
-
```javascript
|
|
121
|
-
photosuite({
|
|
122
|
-
// ...
|
|
123
|
-
exif: {
|
|
124
|
-
enabled: true,
|
|
125
|
-
// Custom fields: Focal Length, Aperture, Shutter Speed, ISO
|
|
126
|
-
fields: ['FocalLength', 'FNumber', 'ExposureTime', 'ISO'],
|
|
127
|
-
// Custom separator
|
|
128
|
-
separator: ' · '
|
|
129
|
-
}
|
|
130
|
-
})
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
###
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
//
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
```
|
|
318
|
-
|
|
319
|
-
## FAQ
|
|
320
|
-
|
|
321
|
-
**Q: My non-article pages (e.g. about page) still show EXIF info even though they're outside the `scope` container.**
|
|
322
|
-
A: `scope` only controls *client-side* behavior. The EXIF rehype plugin runs at build time on every Markdown file. Restrict it via `exif.include` / `exif.exclude` glob patterns, or add `exif: false` to a page's frontmatter. See [EXIF Data Display § Per-Page Filtering](#2-exif-data-display).
|
|
323
|
-
|
|
324
|
-
**Q: Why isn't EXIF data showing?**
|
|
325
|
-
A: Please check the following:
|
|
326
|
-
1. Does the image contain EXIF data? (Some compression tools strip EXIF)
|
|
327
|
-
2. EXIF data is only displayed when at least the exposure triangle (Focal Length, Aperture, Shutter Speed) is present.
|
|
328
|
-
|
|
329
|
-
**Q: I only want to use Photosuite on certain images, what should I do?**
|
|
330
|
-
A: You can precisely control the scope via CSS selectors (comma-separated for multiple selectors). For example, only take effect inside elements with ID `#main`:
|
|
331
|
-
|
|
332
|
-
```javascript
|
|
333
|
-
photosuite({
|
|
334
|
-
scope: '#main',
|
|
335
|
-
// ... other configurations
|
|
336
|
-
})
|
|
337
|
-
```
|
|
338
|
-
|
|
339
|
-
## Contributors
|
|
340
|
-
|
|
341
|
-
One line of code, one plugin, for independent blogs, it is insignificant, like dust.
|
|
342
|
-
|
|
343
|
-
But we insist on taking root in this soil, letting thought be free, and letting the soul rest!
|
|
344
|
-
|
|
345
|
-
[](https://github.com/achuanya/photosuite/graphs/contributors)
|
|
346
|
-
|
|
347
|
-
## Users
|
|
348
|
-
|
|
349
|
-
- [Frevia](https://www.frevia.site)
|
|
350
|
-
- [ZhiJun's Blog](https://blog.zhijun.io)
|
|
351
|
-
|
|
352
|
-
If you are using using Photosuite, please edit this file to add your blog.
|
|
353
|
-
|
|
354
|
-
## License
|
|
355
|
-
|
|
1
|
+
<div align="center">
|
|
2
|
+
<a href="/">
|
|
3
|
+
<img src="/public/logo.svg" alt="Photosuite" width="120" />
|
|
4
|
+
<br/>
|
|
5
|
+
<h1>Photosuite</h1>
|
|
6
|
+
</a>
|
|
7
|
+
|
|
8
|
+
<p>
|
|
9
|
+
<a href="https://photosuite.lhasa.icu">Official Website</a> •
|
|
10
|
+
<a href="https://github.com/achuanya/photosuite/releases">Latest Release</a> •
|
|
11
|
+
<a href="https://github.com/achuanya/photosuite/blob/main/Changelog.md">Changelog</a> •
|
|
12
|
+
<a href="./README.zh-CN.md">简体中文</a>
|
|
13
|
+
</p>
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
Photosuite is a simple yet feature-rich image integration tailored for independent blogs. It modularly integrates lightbox, EXIF data, path resolution, image grid, and more into a single, zero-config package. Out of the box, no tedious configuration required—give your blog images a fresh look with just one line of code!
|
|
17
|
+
|
|
18
|
+
## Features
|
|
19
|
+
|
|
20
|
+
* **Lightbox**: Customized Fancybox integration, minimalist and practical.
|
|
21
|
+
* **Static EXIF**: Integrated `exiftool-vendored.js` supporting custom EXIF parameters.
|
|
22
|
+
* **Path Resolution**: Just insert the filename, and the path is auto-resolved at build time.
|
|
23
|
+
* **Captions**: Automatically displays image `alt` attributes as captions.
|
|
24
|
+
* **Image Grid**: Automatically groups consecutive images (2-3) into a grid layout, each independently clickable.
|
|
25
|
+
* **Extreme Performance**: All features are purely static, processed at build time, runtime dependency-free, modular, and loaded on demand.
|
|
26
|
+
* **Zero-Config**: Default settings satisfy most needs, with rich options for deep customization.
|
|
27
|
+
|
|
28
|
+
## Installation
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pnpm add photosuite
|
|
32
|
+
# or
|
|
33
|
+
npm install photosuite
|
|
34
|
+
# or
|
|
35
|
+
yarn add photosuite
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Quick Start
|
|
39
|
+
|
|
40
|
+
Integrating Photosuite with Astro is very simple, just add the following configuration to `astro.config.js`:
|
|
41
|
+
|
|
42
|
+
```javascript
|
|
43
|
+
import { defineConfig } from 'astro/config';
|
|
44
|
+
import photosuite from 'photosuite';
|
|
45
|
+
import "photosuite/dist/photosuite.css";
|
|
46
|
+
|
|
47
|
+
export default defineConfig({
|
|
48
|
+
integrations: [
|
|
49
|
+
photosuite({
|
|
50
|
+
// [Required] Specify the CSS selector for the scope
|
|
51
|
+
// Recommended: Your content container to avoid affecting other parts of the site. Supports multiple selectors separated by commas.
|
|
52
|
+
scope: '#main',
|
|
53
|
+
})
|
|
54
|
+
]
|
|
55
|
+
});
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Once configured, Photosuite will automatically process all images within your specified scope.
|
|
59
|
+
|
|
60
|
+
## Features & Configuration
|
|
61
|
+
|
|
62
|
+
### 1. Path Resolution
|
|
63
|
+
|
|
64
|
+
Managing image paths in blog posts can be tedious. Photosuite offers flexible resolution strategies that you can configure according to your needs.
|
|
65
|
+
|
|
66
|
+
**Scenario A: All images in a single domain/directory**
|
|
67
|
+
|
|
68
|
+
```javascript
|
|
69
|
+
photosuite({
|
|
70
|
+
scope: '#main',
|
|
71
|
+
imageBase: 'https://cdn.example.com/images/',
|
|
72
|
+
})
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**Markdown Usage:**
|
|
76
|
+
```markdown
|
|
77
|
+

|
|
78
|
+
<!-- Resolves to: https://cdn.example.com/images/photo.jpg -->
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
**Scenario B: Separate image directory per post (Default)**
|
|
82
|
+
|
|
83
|
+
You can specify the directory name in the Frontmatter:
|
|
84
|
+
|
|
85
|
+
```yaml
|
|
86
|
+
---
|
|
87
|
+
title: My First GitHub PR
|
|
88
|
+
imageDir: "2025-11-26-my-first-github-pr"
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+

|
|
92
|
+
<!-- Resolves to: https://cdn.example.com/images/2025-11-26-my-first-github-pr/photo.jpg -->
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
**Scenario C: Use filename as directory**
|
|
96
|
+
|
|
97
|
+
```javascript
|
|
98
|
+
photosuite({
|
|
99
|
+
scope: '#main',
|
|
100
|
+
imageBase: 'https://cdn.example.com/',
|
|
101
|
+
fileDir: true, // Enable this option
|
|
102
|
+
})
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
If your post filename is `2025-11-26-my-first-github-pr.md`, the image path automatically resolves to:
|
|
106
|
+
|
|
107
|
+
`https://cdn.example.com/images/2025-11-26-my-first-github-pr/photo.jpg`
|
|
108
|
+
|
|
109
|
+
### 2. EXIF Data Display
|
|
110
|
+
|
|
111
|
+
Photosuite uses `exiftool-vendored.js` to extract information at build time.
|
|
112
|
+
|
|
113
|
+
**Default Configuration:**
|
|
114
|
+
Default display: Camera Model, Lens Model, Focal Length, Aperture, Shutter Speed, ISO, Date Original.
|
|
115
|
+
|
|
116
|
+
> NIKON Z 30 · NIKKOR Z DX 16-50mm f/3.5-6.3 VR · 20.5 mm · ƒ/3.8 · 1/15 · ISO 1000 · 2025/12/9
|
|
117
|
+
|
|
118
|
+
**Custom Configuration:**
|
|
119
|
+
|
|
120
|
+
```javascript
|
|
121
|
+
photosuite({
|
|
122
|
+
// ...
|
|
123
|
+
exif: {
|
|
124
|
+
enabled: true,
|
|
125
|
+
// Custom fields: Focal Length, Aperture, Shutter Speed, ISO
|
|
126
|
+
fields: ['FocalLength', 'FNumber', 'ExposureTime', 'ISO'],
|
|
127
|
+
// Custom separator
|
|
128
|
+
separator: ' · '
|
|
129
|
+
}
|
|
130
|
+
})
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### 3. Image Grid
|
|
134
|
+
|
|
135
|
+
Photosuite supports automatically combining consecutive images into a grid layout. When 2-3 images are placed adjacently in Markdown, they will be automatically combined into a grid, and each image remains independently clickable.
|
|
136
|
+
|
|
137
|
+
**Markdown Usage:**
|
|
138
|
+
|
|
139
|
+
Two-image grid:
|
|
140
|
+
```markdown
|
|
141
|
+

|
|
142
|
+

|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Three-image grid:
|
|
146
|
+
```markdown
|
|
147
|
+

|
|
148
|
+

|
|
149
|
+

|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
**Features:**
|
|
153
|
+
- Automatically detects consecutive images (2-3 images)
|
|
154
|
+
- Each image has consistent width, evenly dividing the container
|
|
155
|
+
- Each image is independently clickable with lightbox support
|
|
156
|
+
- Interactive experience: Image zooms in slightly on hover
|
|
157
|
+
- Responsive design: automatically switches to single-column layout on mobile devices
|
|
158
|
+
|
|
159
|
+
**Configuration:**
|
|
160
|
+
```javascript
|
|
161
|
+
photosuite({
|
|
162
|
+
// ...
|
|
163
|
+
// Disable image grid
|
|
164
|
+
imageGrid: false,
|
|
165
|
+
})
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### 4. Lightbox & Captions
|
|
169
|
+
|
|
170
|
+
Fancybox has been customized to differ slightly from the official version.
|
|
171
|
+
|
|
172
|
+
Supports native configuration, refer to: [Fancybox](https://fancyapps.com/fancybox/)
|
|
173
|
+
|
|
174
|
+
```javascript
|
|
175
|
+
photosuite({
|
|
176
|
+
// ...
|
|
177
|
+
// Disable lightbox
|
|
178
|
+
fancybox: false,
|
|
179
|
+
|
|
180
|
+
// Disable captions
|
|
181
|
+
imageAlts: false,
|
|
182
|
+
|
|
183
|
+
// Fancybox native options
|
|
184
|
+
fancyboxOptions: {
|
|
185
|
+
Carousel: {
|
|
186
|
+
infinite: false,
|
|
187
|
+
Toolbar: {
|
|
188
|
+
display: {
|
|
189
|
+
left: ["infobar"],
|
|
190
|
+
middle: [],
|
|
191
|
+
right: ["slideshow", "download", "thumbs", "close"],
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
}
|
|
196
|
+
})
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
## Complete Configuration Reference
|
|
200
|
+
|
|
201
|
+
### Parameter List
|
|
202
|
+
|
|
203
|
+
| Parameter | Type | Required | Default | Description |
|
|
204
|
+
| :--- | :--- | :---: | :--- | :--- |
|
|
205
|
+
| `scope` | `string` | ✅ | - | **Scope**. CSS selector, only processes images within this container. Supports multiple selectors separated by commas. |
|
|
206
|
+
| `selector` | `string` | ❌ | `"a[data-fancybox]"` | **Image Selector**. Specifies which images need lightbox effect. |
|
|
207
|
+
| `imageBase` | `string` | ❌ | - | **Base Image URL**. Prefix used for splicing relative paths. |
|
|
208
|
+
| `imageDir` | `string` | ❌ | `"imageDir"` | **Directory Field Name**. Field name in Markdown Frontmatter to specify image subdirectory. |
|
|
209
|
+
| `fileDir` | `boolean` | ❌ | `false` | **Filename Archiving**. Whether to automatically use Markdown filename as image subdirectory. |
|
|
210
|
+
| `fancybox` | `boolean` | ❌ | `true` | **Enable Lightbox**. Whether to load Fancybox module. |
|
|
211
|
+
| `imageAlts` | `boolean` | ❌ | `true` | **Enable Captions**. Whether to display `alt` attribute as image caption. |
|
|
212
|
+
| `imageGrid` | `boolean` | ❌ | `true` | **Enable Image Grid**. Whether to combine consecutive images (2-3) into a grid layout. |
|
|
213
|
+
| `exif` | `boolean` \| `object` | ❌ | `true` | **Enable EXIF**. `false` to disable, `true` for default config, or pass object to customize via fields:[]. |
|
|
214
|
+
| `fancyboxOptions` | `object` | ❌ | - | **Native Lightbox Config**. Configuration items passed through to Fancybox. |
|
|
215
|
+
|
|
216
|
+
### Full Configuration Code Example
|
|
217
|
+
|
|
218
|
+
```javascript
|
|
219
|
+
import photosuite from 'photosuite';
|
|
220
|
+
import "photosuite/dist/photosuite.css";
|
|
221
|
+
|
|
222
|
+
photosuite({
|
|
223
|
+
// ----------------
|
|
224
|
+
// Required
|
|
225
|
+
// ----------------
|
|
226
|
+
scope: '#main', // Your content container class name
|
|
227
|
+
|
|
228
|
+
// ----------------
|
|
229
|
+
// Optional (Values below are defaults)
|
|
230
|
+
// ----------------
|
|
231
|
+
|
|
232
|
+
// Basic Settings
|
|
233
|
+
selector: 'a[data-fancybox]',
|
|
234
|
+
|
|
235
|
+
// Path Resolution
|
|
236
|
+
imageBase: '',
|
|
237
|
+
imageDir: 'imageDir',
|
|
238
|
+
fileDir: false,
|
|
239
|
+
|
|
240
|
+
// Feature Toggles
|
|
241
|
+
fancybox: true,
|
|
242
|
+
imageAlts: true,
|
|
243
|
+
imageGrid: true,
|
|
244
|
+
|
|
245
|
+
// EXIF Detailed Configuration
|
|
246
|
+
exif: {
|
|
247
|
+
enabled: true,
|
|
248
|
+
fields: [
|
|
249
|
+
'Model', // Camera Model
|
|
250
|
+
'LensModel', // Lens Model
|
|
251
|
+
'FocalLength', // Focal Length
|
|
252
|
+
'FNumber', // Aperture
|
|
253
|
+
'ExposureTime', // Shutter Speed
|
|
254
|
+
'ISO', // ISO
|
|
255
|
+
'DateTimeOriginal' // Date Original
|
|
256
|
+
],
|
|
257
|
+
separator: ' · ' // Separator
|
|
258
|
+
},
|
|
259
|
+
|
|
260
|
+
// Fancybox native options
|
|
261
|
+
fancyboxOptions: {
|
|
262
|
+
wheel: "slide", // Enable wheel navigation
|
|
263
|
+
Hash: false, // Disable URL hash
|
|
264
|
+
Html: { // HTML content configuration
|
|
265
|
+
video: { // Video configuration
|
|
266
|
+
autoplay: false, // Disable video autoplay
|
|
267
|
+
},
|
|
268
|
+
},
|
|
269
|
+
Carousel: { // Carousel configuration
|
|
270
|
+
Thumbs: false, // Disable thumbnails
|
|
271
|
+
infinite: false, // Disable infinite loop
|
|
272
|
+
Toolbar: { // Toolbar configuration
|
|
273
|
+
display: { // Display items configuration
|
|
274
|
+
left: ["counter"], // Left side: page counter
|
|
275
|
+
right: ["autoplay", "close"], // Right side: autoplay and close buttons
|
|
276
|
+
},
|
|
277
|
+
},
|
|
278
|
+
},
|
|
279
|
+
}
|
|
280
|
+
})
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
## FAQ
|
|
284
|
+
|
|
285
|
+
**Q: Why isn't EXIF data showing?**
|
|
286
|
+
A: Please check the following:
|
|
287
|
+
1. Does the image contain EXIF data? (Some compression tools strip EXIF)
|
|
288
|
+
2. EXIF data is only displayed when at least the exposure triangle (Focal Length, Aperture, Shutter Speed) is present.
|
|
289
|
+
|
|
290
|
+
**Q: I only want to use Photosuite on certain images, what should I do?**
|
|
291
|
+
A: You can precisely control the scope via CSS selectors (comma-separated for multiple selectors). For example, only take effect inside elements with ID `#main`:
|
|
292
|
+
|
|
293
|
+
```javascript
|
|
294
|
+
photosuite({
|
|
295
|
+
scope: '#main',
|
|
296
|
+
// ... other configurations
|
|
297
|
+
})
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
## Contributors
|
|
301
|
+
|
|
302
|
+
One line of code, one plugin, for independent blogs, it is insignificant, like dust.
|
|
303
|
+
|
|
304
|
+
But we insist on taking root in this soil, letting thought be free, and letting the soul rest!
|
|
305
|
+
|
|
306
|
+
[](https://github.com/achuanya/photosuite/graphs/contributors)
|
|
307
|
+
|
|
308
|
+
## Users
|
|
309
|
+
|
|
310
|
+
- [Frevia](https://www.frevia.site)
|
|
311
|
+
- [ZhiJun's Blog](https://blog.zhijun.io)
|
|
312
|
+
|
|
313
|
+
If you are using using Photosuite, please edit this file to add your blog.
|
|
314
|
+
|
|
315
|
+
## License
|
|
316
|
+
|
|
356
317
|
[GPL-3.0](./LICENSE)
|