jekyll_picture_tag 1.10.0 → 1.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +79 -0
- data/docs/Gemfile +4 -2
- data/docs/Gemfile.lock +14 -12
- data/docs/_config.yml +6 -10
- data/docs/devs/contributing/code.md +44 -0
- data/docs/devs/contributing/docs.md +13 -0
- data/docs/devs/contributing/index.md +15 -0
- data/docs/devs/contributing/setup.md +13 -0
- data/docs/devs/contributing/testing.md +41 -0
- data/docs/devs/index.md +7 -0
- data/docs/{releases.md → devs/releases.md} +37 -13
- data/docs/index.md +42 -26
- data/docs/users/configuration/cdn.md +35 -0
- data/docs/users/configuration/directories.md +34 -0
- data/docs/users/configuration/disable.md +24 -0
- data/docs/users/configuration/fast_build.md +28 -0
- data/docs/users/configuration/ignore_missing.md +23 -0
- data/docs/users/configuration/index.md +29 -0
- data/docs/users/configuration/kramdown_fix.md +20 -0
- data/docs/users/configuration/relative_urls.md +15 -0
- data/docs/users/configuration/suppress_warnings.md +16 -0
- data/docs/users/index.md +7 -0
- data/docs/users/installation.md +52 -0
- data/docs/users/liquid_tag/argument_reference/alternate_images.md +18 -0
- data/docs/users/liquid_tag/argument_reference/attributes.md +42 -0
- data/docs/users/liquid_tag/argument_reference/base_image.md +12 -0
- data/docs/users/liquid_tag/argument_reference/crop.md +48 -0
- data/docs/users/liquid_tag/argument_reference/link.md +16 -0
- data/docs/users/liquid_tag/argument_reference/preset.md +17 -0
- data/docs/users/liquid_tag/argument_reference/readme.md +9 -0
- data/docs/users/liquid_tag/examples.md +93 -0
- data/docs/users/liquid_tag/index.md +31 -0
- data/docs/users/notes/git_lfs.md +7 -0
- data/docs/users/notes/github_pages.md +5 -0
- data/docs/users/notes/html_attributes.md +5 -0
- data/docs/users/notes/index.md +6 -0
- data/docs/users/notes/input_checking.md +6 -0
- data/docs/users/notes/kramdown_bug.md +41 -0
- data/docs/users/notes/managing_images.md +21 -0
- data/docs/{migration.md → users/notes/migration.md} +0 -0
- data/docs/users/presets/cropping.md +61 -0
- data/docs/users/presets/default.md +23 -0
- data/docs/users/presets/examples.md +79 -0
- data/docs/users/presets/fallback_image.md +28 -0
- data/docs/users/presets/html_attributes.md +26 -0
- data/docs/users/presets/image_formats.md +21 -0
- data/docs/users/presets/image_quality.md +105 -0
- data/docs/users/presets/index.md +101 -0
- data/docs/users/presets/link_source.md +16 -0
- data/docs/users/presets/markup_formats/fragments.md +48 -0
- data/docs/users/presets/markup_formats/javascript_friendly.md +57 -0
- data/docs/users/presets/markup_formats/readme.md +43 -0
- data/docs/users/presets/markup_formats/standard_html.md +25 -0
- data/docs/users/presets/media_queries.md +36 -0
- data/docs/users/presets/nomarkdown_override.md +17 -0
- data/docs/users/presets/pixel_ratio_srcsets.md +32 -0
- data/docs/users/presets/quality_width_graph.png +0 -0
- data/docs/users/presets/width_height_attributes.md +34 -0
- data/docs/users/presets/width_srcsets.md +85 -0
- data/jekyll_picture_tag.gemspec +4 -5
- data/lib/jekyll_picture_tag.rb +3 -4
- data/lib/jekyll_picture_tag/cache.rb +3 -0
- data/lib/jekyll_picture_tag/cache/base.rb +59 -0
- data/lib/jekyll_picture_tag/cache/generated.rb +20 -0
- data/lib/jekyll_picture_tag/cache/source.rb +19 -0
- data/lib/jekyll_picture_tag/defaults/presets.yml +1 -0
- data/lib/jekyll_picture_tag/images.rb +3 -0
- data/lib/jekyll_picture_tag/images/generated_image.rb +127 -0
- data/lib/jekyll_picture_tag/{img_uri.rb → images/img_uri.rb} +1 -0
- data/lib/jekyll_picture_tag/images/source_image.rb +103 -0
- data/lib/jekyll_picture_tag/instructions/arg_splitter.rb +3 -2
- data/lib/jekyll_picture_tag/instructions/configuration.rb +1 -1
- data/lib/jekyll_picture_tag/instructions/preset.rb +24 -4
- data/lib/jekyll_picture_tag/instructions/set.rb +5 -1
- data/lib/jekyll_picture_tag/output_formats/basic.rb +16 -14
- data/lib/jekyll_picture_tag/output_formats/img.rb +11 -0
- data/lib/jekyll_picture_tag/output_formats/picture.rb +22 -0
- data/lib/jekyll_picture_tag/router.rb +3 -2
- data/lib/jekyll_picture_tag/srcsets/basic.rb +10 -1
- data/lib/jekyll_picture_tag/utils.rb +14 -0
- data/lib/jekyll_picture_tag/version.rb +1 -1
- data/readme.md +9 -7
- metadata +78 -45
- data/docs/_layouts/directory.html +0 -32
- data/docs/assets/style.css +0 -31
- data/docs/contributing.md +0 -109
- data/docs/example_presets.md +0 -116
- data/docs/global_configuration.md +0 -173
- data/docs/installation.md +0 -45
- data/docs/notes.md +0 -91
- data/docs/output.md +0 -63
- data/docs/presets.md +0 -361
- data/docs/usage.md +0 -143
- data/lib/jekyll_picture_tag/generated_image.rb +0 -161
- data/lib/jekyll_picture_tag/source_image.rb +0 -87
data/docs/presets.md
DELETED
@@ -1,361 +0,0 @@
|
|
1
|
-
---
|
2
|
-
---
|
3
|
-
|
4
|
-
# Writing Presets
|
5
|
-
|
6
|
-
Presets are named collections of settings that determine basically everything about JPT's output.
|
7
|
-
They are stored in `_data/picture.yml`, to avoid cluttering `_config.yml`. You will have to create
|
8
|
-
this file, and probably the `_data/` directory as well.
|
9
|
-
|
10
|
-
Here's an [example data file]({{ site.baseurl }}/example_presets).
|
11
|
-
|
12
|
-
Any settings which are specific to particular output formats are documented on the [output
|
13
|
-
formats]({{site.baseurl}}/output) page.
|
14
|
-
|
15
|
-
## Required Knowledge
|
16
|
-
|
17
|
-
If you don't know the difference between resolution switching and art direction, stop now and read
|
18
|
-
the [MDN Responsive Images
|
19
|
-
guide](https://developer.mozilla.org/en-US/docs/Learn/HTML/Multimedia_and_embedding/Responsive_images)
|
20
|
-
in detail. Ideally, play around with a basic HTML file, a few test images, and a few different
|
21
|
-
browser widths until you understand it.
|
22
|
-
|
23
|
-
## Media Presets
|
24
|
-
|
25
|
-
_Format:_
|
26
|
-
|
27
|
-
```yml
|
28
|
-
media_presets:
|
29
|
-
(name): (css media query)
|
30
|
-
(name): (css media query)
|
31
|
-
(...)
|
32
|
-
|
33
|
-
```
|
34
|
-
|
35
|
-
_Example:_
|
36
|
-
|
37
|
-
```yml
|
38
|
-
media_presets:
|
39
|
-
desktop: "min-width: 1200px"
|
40
|
-
```
|
41
|
-
|
42
|
-
These are named media queries for use in a few different places: specifying alternate source images
|
43
|
-
in your liquid tag, building the 'sizes' attribute within your presets, and in a few configuration
|
44
|
-
settings. Quotes are recommended around the media queries, because yml gets confused by colons.
|
45
|
-
|
46
|
-
## Markup Presets
|
47
|
-
|
48
|
-
_Format:_
|
49
|
-
|
50
|
-
```yml
|
51
|
-
markup_presets:
|
52
|
-
(name):
|
53
|
-
(option): (setting)
|
54
|
-
(option): (setting)
|
55
|
-
(...)
|
56
|
-
(...)
|
57
|
-
```
|
58
|
-
|
59
|
-
_Example:_
|
60
|
-
|
61
|
-
```yml
|
62
|
-
markup_presets:
|
63
|
-
default:
|
64
|
-
formats: [webp, original]
|
65
|
-
widths: [200, 400, 800, 1600]
|
66
|
-
link_source: true
|
67
|
-
lazy:
|
68
|
-
markup: data_auto
|
69
|
-
widths: [200, 400, 800, 1600]
|
70
|
-
link_source: true
|
71
|
-
noscript: true
|
72
|
-
```
|
73
|
-
|
74
|
-
Each entry is a pre-defined collection of settings to build a given chunk of text (usually HTML) and
|
75
|
-
its respective images. You can select one as the first argument given to the tag:
|
76
|
-
|
77
|
-
{% raw %}
|
78
|
-
`{% picture my-preset image.jpg %}`
|
79
|
-
{% endraw %}
|
80
|
-
|
81
|
-
The `default` preset will be used if none is specified. A preset name can't contain a `.` (period).
|
82
|
-
|
83
|
-
#### A Note on srcsets
|
84
|
-
|
85
|
-
For images that are different sizes on different screens (most images), use a width-based srcset
|
86
|
-
(which is the default). Specify a `widths` setting (or don't, for the default set), and optionally
|
87
|
-
the `sizes` and `size` settings.
|
88
|
-
|
89
|
-
Use a multiplier-based srcset when the image will always be the same size, regardless of screen
|
90
|
-
width (thumbnails and icons). To use a multiplier-based srcset, set `pixel_ratios` and `base_width`.
|
91
|
-
|
92
|
-
### Settings reference
|
93
|
-
|
94
|
-
- **Markup format**
|
95
|
-
|
96
|
-
_Format:_ `markup: (setting)`
|
97
|
-
|
98
|
-
_Default_: `auto`
|
99
|
-
|
100
|
-
Defines what format the generated text will take. They are documented [here]({{ site.baseurl }}/output).
|
101
|
-
|
102
|
-
* **Image Formats**
|
103
|
-
|
104
|
-
_Format:_ `format: [format1, format2, (...)]`
|
105
|
-
|
106
|
-
_Example:_ `format: [webp, original]`
|
107
|
-
|
108
|
-
_Default_: `original`
|
109
|
-
|
110
|
-
Array (yml sequence) of the image formats you'd like to generate, in decreasing order of
|
111
|
-
preference. Browsers will render the first format they find and understand, so **If you put jpg
|
112
|
-
before webp, your webp images will never be used**. `original` does what you'd expect. To supply
|
113
|
-
webp, you must have an imagemagick webp delegate installed. (Most package managers just name it
|
114
|
-
'webp')
|
115
|
-
|
116
|
-
_Supported formats are anything which imagemagick supports, and has an installed delegate. See a
|
117
|
-
list by running `$ convert --version`_
|
118
|
-
|
119
|
-
* **Widths**
|
120
|
-
|
121
|
-
_Format:_ `widths: [integer, integer, (...)]`
|
122
|
-
|
123
|
-
_Example:_ `widths: [600, 800, 1200]`
|
124
|
-
|
125
|
-
_Default_: `[400, 600, 800, 1000]`
|
126
|
-
|
127
|
-
Array of image widths to generate, in pixels. For use when you want a width-based srcset
|
128
|
-
(`srcset="img.jpg 800w, img2.jpg 1600w"`).
|
129
|
-
|
130
|
-
* **Media_widths**
|
131
|
-
|
132
|
-
_Format:_
|
133
|
-
|
134
|
-
```yml
|
135
|
-
media_widths:
|
136
|
-
(media preset name): [integer, integer, (...)]
|
137
|
-
```
|
138
|
-
|
139
|
-
_Example:_
|
140
|
-
|
141
|
-
```yml
|
142
|
-
media_widths:
|
143
|
-
mobile: [400, 600, 800]
|
144
|
-
```
|
145
|
-
|
146
|
-
_Default:_ Widths setting
|
147
|
-
|
148
|
-
If you are using art direction, there is no sense in generating desktop-size files for your mobile
|
149
|
-
image. You can specify sets of widths to associate with given media queries. If not specified,
|
150
|
-
will use `widths` setting.
|
151
|
-
|
152
|
-
* **Sizes**
|
153
|
-
|
154
|
-
_Format:_
|
155
|
-
|
156
|
-
```yml
|
157
|
-
sizes:
|
158
|
-
(media preset): (CSS dimension)
|
159
|
-
(...)
|
160
|
-
```
|
161
|
-
|
162
|
-
_Example:_
|
163
|
-
|
164
|
-
```yml
|
165
|
-
sizes:
|
166
|
-
mobile: 80vw
|
167
|
-
tablet: 60vw
|
168
|
-
desktop: 900px
|
169
|
-
```
|
170
|
-
|
171
|
-
Conditional sizes, used to construct the `sizes=` HTML attribute telling the browser how wide your
|
172
|
-
image will be (on the screen) when a given media query is true. CSS dimensions can be given in
|
173
|
-
`px`, `em`, or `vw`. To be used along with a width-based srcset.
|
174
|
-
|
175
|
-
Provide these in order of most restrictive to least restrictive. The browser will choose the
|
176
|
-
first one with an applicable media query.
|
177
|
-
|
178
|
-
You don't have to provide a sizes attribute at all. If you don't, the browser will assume the
|
179
|
-
image is 100% the width of the viewport.
|
180
|
-
|
181
|
-
* **Size**
|
182
|
-
|
183
|
-
_Format:_ `size: (CSS Dimension)`
|
184
|
-
|
185
|
-
_Example:_ `size: 80vw`
|
186
|
-
|
187
|
-
Unconditional `sizes` setting, to be supplied either alone or after all conditional sizes.
|
188
|
-
|
189
|
-
* **Pixel Ratios**
|
190
|
-
|
191
|
-
_Format:_ `pixel_ratios: [number, number, number (...)]`
|
192
|
-
|
193
|
-
_Example:_ `pixel_ratios: [1, 1.5, 2]`
|
194
|
-
|
195
|
-
Array of images to construct, given in multiples of the base width. If you set this, you must also
|
196
|
-
give a `base_width`.
|
197
|
-
|
198
|
-
Set this when you want a multiplier based srcset (example: `srcset="img.jpg 1x, img2.jpg 2x"`).
|
199
|
-
|
200
|
-
* **Base Width**
|
201
|
-
|
202
|
-
_Format:_ `base_width: integer`
|
203
|
-
|
204
|
-
_Example:_ `base_width: 100`
|
205
|
-
|
206
|
-
When using pixel ratios, you must supply a base width. This sets how wide the 1x image should be.
|
207
|
-
|
208
|
-
* **Crop & Media Crop**
|
209
|
-
|
210
|
-
_Format:_
|
211
|
-
|
212
|
-
```yml
|
213
|
-
crop: (geometery)
|
214
|
-
media_crop:
|
215
|
-
(media_preset): (geometry)
|
216
|
-
(media_preset): (geometry)
|
217
|
-
(...)
|
218
|
-
```
|
219
|
-
|
220
|
-
_Example:_
|
221
|
-
|
222
|
-
```yml
|
223
|
-
crop: 16:9
|
224
|
-
media_crop:
|
225
|
-
tablet: 3:2
|
226
|
-
mobile: 1:1
|
227
|
-
```
|
228
|
-
|
229
|
-
**Check the [ installation guide ](installation) before using this feature.**
|
230
|
-
|
231
|
-
Crop geometry, given either generally or for specific media presets. The hierarchy is:
|
232
|
-
`tag argument` > `media_crop:` > `crop:`.
|
233
|
-
|
234
|
-
This setting accepts the same arguments as the `crop geometry` [tag parameter](usage).
|
235
|
-
|
236
|
-
|
237
|
-
* **Gravity & Media_gravity**
|
238
|
-
|
239
|
-
```yml
|
240
|
-
crop: (gravity)
|
241
|
-
media_crop:
|
242
|
-
(media_preset): (gravity)
|
243
|
-
(media_preset): (gravity)
|
244
|
-
(...)
|
245
|
-
```
|
246
|
-
|
247
|
-
_Example:_
|
248
|
-
|
249
|
-
```yml
|
250
|
-
crop: north
|
251
|
-
media_crop:
|
252
|
-
tablet: east
|
253
|
-
mobile: southwest
|
254
|
-
```
|
255
|
-
|
256
|
-
Crop gravity, given either generally or for specific media presets. The hierarchy is:
|
257
|
-
`tag argument` > `media_crop:` > `crop:` > `center` (default).
|
258
|
-
|
259
|
-
This setting accepts the same arguments as the `crop gravity` [tag parameter](usage).
|
260
|
-
|
261
|
-
* **Quality**
|
262
|
-
|
263
|
-
_Format:_ `quality: 0 <= integer <= 100`
|
264
|
-
|
265
|
-
_Example:_ `quality: 80`
|
266
|
-
|
267
|
-
_Default:_ `75`
|
268
|
-
|
269
|
-
This allows you to specify an image compression level for all image formats (where it makes sense,
|
270
|
-
anyway). The next option allows you to set them per format.
|
271
|
-
|
272
|
-
* **Format Quality**
|
273
|
-
|
274
|
-
_Format:_
|
275
|
-
|
276
|
-
```yml
|
277
|
-
format_quality:
|
278
|
-
(format): 0 <= integer <= 100
|
279
|
-
(...)
|
280
|
-
```
|
281
|
-
|
282
|
-
_Example:_
|
283
|
-
|
284
|
-
```
|
285
|
-
format_quality:
|
286
|
-
jpg: 75
|
287
|
-
png: 65
|
288
|
-
webp: 55
|
289
|
-
```
|
290
|
-
|
291
|
-
_Default:_ quality setting (above)
|
292
|
-
|
293
|
-
This allows you to specify quality settings for various image formats, allowing you to take
|
294
|
-
advantage of webp's better compression algorithm without trashing your jpg images (for example).
|
295
|
-
If you don't give a setting for a particular format it'll fall back to the `quality` setting
|
296
|
-
above, and if you don't set _that_ it'll default to 75.
|
297
|
-
|
298
|
-
* **HTML Attributes**
|
299
|
-
|
300
|
-
_Format:_
|
301
|
-
|
302
|
-
```yml
|
303
|
-
attributes:
|
304
|
-
(element): '(attributes)'
|
305
|
-
(...)
|
306
|
-
```
|
307
|
-
|
308
|
-
_Example:_
|
309
|
-
|
310
|
-
```yml
|
311
|
-
attributes:
|
312
|
-
img: 'class="soopercool" data-awesomeness="11"'
|
313
|
-
picture: 'class="even-cooler"'
|
314
|
-
```
|
315
|
-
|
316
|
-
HTML attributes you would like to add. The same arguments are available here as in the liquid
|
317
|
-
tag: HTML element names, `alt:`, `link:`, and `parent:`. Unescaped double quotes cause problems
|
318
|
-
with yml, so it's recommended to surround them with single quotes.
|
319
|
-
|
320
|
-
* **Fallback Width**
|
321
|
-
|
322
|
-
_Format:_ `fallback_width: (integer)`
|
323
|
-
|
324
|
-
_Example:_ `fallback_width: 800`
|
325
|
-
|
326
|
-
_Default_: `800`
|
327
|
-
|
328
|
-
Width of the fallback image.
|
329
|
-
|
330
|
-
* **Fallback Format**
|
331
|
-
|
332
|
-
_Format:_ `fallback_format: (format)`
|
333
|
-
|
334
|
-
_Example:_ `fallback_format: jpg`
|
335
|
-
|
336
|
-
_Default_: `original`
|
337
|
-
|
338
|
-
Format of the fallback image
|
339
|
-
|
340
|
-
* **Source Image Link**
|
341
|
-
|
342
|
-
_Format:_ `link_source: (true|false)`
|
343
|
-
|
344
|
-
_Example:_ `link_source: true`
|
345
|
-
|
346
|
-
_Default:_ `false`
|
347
|
-
|
348
|
-
Surround image with a link to the original source file. Your source image directory must be
|
349
|
-
published as part of the compiled site. If you run into weird issues with the output, see
|
350
|
-
the [notes]({{ site.baseurl }}/notes).
|
351
|
-
|
352
|
-
* **Nomarkdown override**
|
353
|
-
|
354
|
-
_Format:_ `nomarkdown: (true|false)`
|
355
|
-
|
356
|
-
_Example:_ `nomarkdown: false`
|
357
|
-
|
358
|
-
_Default:_ `nil`
|
359
|
-
|
360
|
-
Hard setting for `{::nomarkdown}` tags, overrides both autodetection and the global setting in
|
361
|
-
`_config.yml`. See the [notes]({{ site.baseurl }}/notes) for a detailed explanation.
|
data/docs/usage.md
DELETED
@@ -1,143 +0,0 @@
|
|
1
|
-
---
|
2
|
-
---
|
3
|
-
|
4
|
-
# How to use the Liquid Tag:
|
5
|
-
|
6
|
-
## Format:
|
7
|
-
|
8
|
-
{% raw %}
|
9
|
-
`{% picture [preset] (image) [crop] [alternate images & crops] [attributes] %}`
|
10
|
-
{% endraw %}
|
11
|
-
|
12
|
-
The only required argument is the base image. Line breaks and extra spaces are fine, and you can
|
13
|
-
use liquid variables anywhere.
|
14
|
-
|
15
|
-
## Examples:
|
16
|
-
|
17
|
-
{% raw %}
|
18
|
-
`{% picture example.jpg %}`
|
19
|
-
|
20
|
-
`{% picture thumbnail example.jpg 1:1 --alt Example Image %}`
|
21
|
-
|
22
|
-
`{% picture example.jpg 16:9 north --picture class="attribute-demo" %}`
|
23
|
-
|
24
|
-
`{% picture blog_index {{ post.image }} --link {{ post.url }} %}`
|
25
|
-
|
26
|
-
`{% picture "some example.jpg" mobile: other\ example.jpg %}`
|
27
|
-
|
28
|
-
```md
|
29
|
-
{% picture
|
30
|
-
hero
|
31
|
-
example.jpg 16:9 east
|
32
|
-
tablet: example_cropped.jpg 3:2 east
|
33
|
-
mobile: example_cropped_more.jpg 1:1-50+0 east
|
34
|
-
--alt Happy Puppy
|
35
|
-
--picture class="hero"
|
36
|
-
--link /
|
37
|
-
%}
|
38
|
-
```
|
39
|
-
|
40
|
-
{% endraw %}
|
41
|
-
|
42
|
-
## Argument reference
|
43
|
-
|
44
|
-
Given in order:
|
45
|
-
|
46
|
-
- **Preset**
|
47
|
-
|
48
|
-
Select a [markup preset]({{ site.baseurl }}/presets#markup-presets), or omit to use the `default` preset. Presets
|
49
|
-
are collections of settings that determine nearly everything about JPT's output, from the image
|
50
|
-
formats used to the exact format your markup will take.
|
51
|
-
|
52
|
-
- **Base Image** (Required)
|
53
|
-
|
54
|
-
Can be any raster image (as long as you have the required ImageMagick delegate). Relative to
|
55
|
-
jekyll's root directory, or the `source` [setting]({{ site.baseurl }}/global_configuration) if you've configured it.
|
56
|
-
|
57
|
-
For filenames with spaces, either use double quotes (`"my image.jpg"`) or a backslash (`my\ image.jpg`).
|
58
|
-
|
59
|
-
- **Crop**
|
60
|
-
|
61
|
-
**Check the [ installation guide ](installation) before using this feature.**
|
62
|
-
|
63
|
-
Crop an image to a given aspect ratio or size. This argument is given as a `geometry` and
|
64
|
-
(optionally) a `gravity`, which can appear in either order and are thin wrappers around
|
65
|
-
ImageMagick's [geometry](http://www.imagemagick.org/script/command-line-processing.php#geometry)
|
66
|
-
and [gravity](http://www.imagemagick.org/script/command-line-options.php#gravity) settings. The
|
67
|
-
values given here will override the preset settings (if present), can be given after every image,
|
68
|
-
and apply only to the preceding image.
|
69
|
-
|
70
|
-
Geometry can take many forms, but most likely you'll want to set an aspect ratio-- given in the
|
71
|
-
standard `width:height` ratio such as `3:2`. Gravity sets which portion of the image to keep, and
|
72
|
-
is given in compass directions (`north`, `southeast`, etc) or `center` (default). Cropping happens
|
73
|
-
before resizing; the preset `widths` setting is a post-crop value.
|
74
|
-
|
75
|
-
If you'd like more fine-grained control, this can be offset by appending `+|-x` and (optionally)
|
76
|
-
`y` pixel values to the _geometry_ (not the gravity!). Example: `1:1+400 west` means "Crop to a
|
77
|
-
1:1 aspect ratio, starting 400 pixels from the left side.", and `north 3:2+0+100` means "Crop to
|
78
|
-
3:2, starting 100 pixels from the top." These can get a bit persnickety; there's nothing to stop
|
79
|
-
you from running off the side of the image. Pay attention.
|
80
|
-
|
81
|
-
For detailed documentation, see ImageMagick's
|
82
|
-
[crop](http://www.imagemagick.org/script/command-line-options.php#crop) tool.
|
83
|
-
|
84
|
-
_Note:_ If you do a lot of trial and error with these, it's a good idea to manually delete your
|
85
|
-
generated images folder more often as each change will build a new set of images without removing
|
86
|
-
the old ones.
|
87
|
-
|
88
|
-
- **Alternate images**
|
89
|
-
|
90
|
-
_Format:_ `(media query preset): (filename) (...)`
|
91
|
-
|
92
|
-
_Example:_ `tablet: img_cropped.jpg mobile: img_cropped_more.jpg`
|
93
|
-
|
94
|
-
Optionally specify any number of alternate base images for given [screen
|
95
|
-
sizes]({{ site.baseurl }}/presets/#media-presets) (specified in `_data/picture.yml`). This is called [art
|
96
|
-
direction](http://usecases.responsiveimages.org/#art-direction), and is one of JPT's strongest
|
97
|
-
features.
|
98
|
-
|
99
|
-
Give your images in order of ascending specificity (The first image is the most general). They will
|
100
|
-
be provided to the browser in reverse order, and it will select the first one with an applicable
|
101
|
-
media query.
|
102
|
-
|
103
|
-
- **Attributes**
|
104
|
-
|
105
|
-
Optionally specify any number of HTML attributes, or an href target. These will be added to any
|
106
|
-
attributes you've set in a preset.
|
107
|
-
|
108
|
-
- **`--link`**
|
109
|
-
|
110
|
-
_Format:_ `--link (some url)`
|
111
|
-
|
112
|
-
_Examples_: `--link https://example.com`, `--link /blog/some_post/`
|
113
|
-
|
114
|
-
Wrap the image in an anchor tag, with the `href` attribute set to whatever value you give it.
|
115
|
-
This will override automatic source image linking, if you have enabled it.
|
116
|
-
|
117
|
-
**Note**: If you get either mangled HTML or extra {::nomarkdown} tags when using this, read
|
118
|
-
[here]({{ site.baseurl }}/notes).
|
119
|
-
|
120
|
-
- **`--alt`**
|
121
|
-
|
122
|
-
_Format:_ `--alt (alt text)`
|
123
|
-
|
124
|
-
_Example:_ `--alt Here is my alt text!`
|
125
|
-
|
126
|
-
Convenience shortcut for `--img alt="..."`
|
127
|
-
|
128
|
-
- **`--(element)`**
|
129
|
-
|
130
|
-
_Format:_ `--(picture|img|source|a|parent) (Standard HTML attributes)`
|
131
|
-
|
132
|
-
_Example:_ `--img class="awesome-fade-in" id="coolio" --a data-awesomeness="11"`
|
133
|
-
|
134
|
-
Apply attributes to a given HTML element. Your options are:
|
135
|
-
|
136
|
-
- `picture`
|
137
|
-
- `img`
|
138
|
-
- `source`
|
139
|
-
- `a` (anchor tag)
|
140
|
-
- `parent`
|
141
|
-
|
142
|
-
`--parent` will be applied to the `<picture>` if present, otherwise the `<img>`; useful when
|
143
|
-
using an `auto` output format.
|