imgproxy 2.1.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +8 -0
  3. data/CHANGELOG.md +74 -0
  4. data/README.md +176 -135
  5. data/UPGRADE.md +136 -0
  6. data/docs/info_options.md +223 -0
  7. data/docs/processing_options.md +724 -0
  8. data/docs/yard/fix_pictures.rb +25 -0
  9. data/docs/yard/github_alerts.rb +16 -0
  10. data/docs/yard/relative_markdown_links.rb +31 -0
  11. data/lib/imgproxy/config.rb +96 -41
  12. data/lib/imgproxy/extensions/active_storage.rb +6 -4
  13. data/lib/imgproxy/extensions/shrine.rb +6 -4
  14. data/lib/imgproxy/option_aliases/info.rb +33 -0
  15. data/lib/imgproxy/option_aliases/processing.rb +74 -0
  16. data/lib/imgproxy/options_builders/base.rb +54 -0
  17. data/lib/imgproxy/options_builders/info.rb +52 -0
  18. data/lib/imgproxy/options_builders/processing.rb +150 -0
  19. data/lib/imgproxy/options_casters/adjust.rb +3 -1
  20. data/lib/imgproxy/options_casters/alpha.rb +27 -0
  21. data/lib/imgproxy/options_casters/array.rb +3 -1
  22. data/lib/imgproxy/options_casters/autoquality.rb +28 -0
  23. data/lib/imgproxy/options_casters/average.rb +27 -0
  24. data/lib/imgproxy/options_casters/background.rb +27 -0
  25. data/lib/imgproxy/options_casters/base64.rb +2 -0
  26. data/lib/imgproxy/options_casters/blur_detections.rb +28 -0
  27. data/lib/imgproxy/options_casters/blurhash.rb +21 -0
  28. data/lib/imgproxy/options_casters/bool.rb +3 -1
  29. data/lib/imgproxy/options_casters/crop.rb +3 -1
  30. data/lib/imgproxy/options_casters/dominant_colors.rb +27 -0
  31. data/lib/imgproxy/options_casters/draw_detections.rb +28 -0
  32. data/lib/imgproxy/options_casters/extend.rb +3 -1
  33. data/lib/imgproxy/options_casters/filename.rb +31 -0
  34. data/lib/imgproxy/options_casters/float.rb +3 -1
  35. data/lib/imgproxy/options_casters/format_quality.rb +19 -0
  36. data/lib/imgproxy/options_casters/gradient.rb +31 -0
  37. data/lib/imgproxy/options_casters/gravity.rb +20 -6
  38. data/lib/imgproxy/options_casters/group.rb +2 -0
  39. data/lib/imgproxy/options_casters/hashsum.rb +24 -0
  40. data/lib/imgproxy/options_casters/integer.rb +2 -0
  41. data/lib/imgproxy/options_casters/jpeg_options.rb +3 -1
  42. data/lib/imgproxy/options_casters/padding.rb +41 -0
  43. data/lib/imgproxy/options_casters/png_options.rb +3 -1
  44. data/lib/imgproxy/options_casters/resize.rb +3 -1
  45. data/lib/imgproxy/options_casters/size.rb +3 -1
  46. data/lib/imgproxy/options_casters/string.rb +2 -0
  47. data/lib/imgproxy/options_casters/trim.rb +3 -1
  48. data/lib/imgproxy/options_casters/unsharp_masking.rb +25 -0
  49. data/lib/imgproxy/options_casters/video_thumbnail_tile.rb +34 -0
  50. data/lib/imgproxy/options_casters/watermark.rb +5 -4
  51. data/lib/imgproxy/options_casters/watermark_size.rb +21 -0
  52. data/lib/imgproxy/options_casters/{gif_options.rb → webp_options.rb} +6 -5
  53. data/lib/imgproxy/options_casters/zoom.rb +27 -0
  54. data/lib/imgproxy/service_config.rb +111 -0
  55. data/lib/imgproxy/trim_array.rb +2 -0
  56. data/lib/imgproxy/url_adapters/active_storage.rb +2 -0
  57. data/lib/imgproxy/url_adapters/shrine.rb +8 -2
  58. data/lib/imgproxy/url_adapters.rb +3 -0
  59. data/lib/imgproxy/url_builders/base.rb +184 -0
  60. data/lib/imgproxy/url_builders/info.rb +44 -0
  61. data/lib/imgproxy/url_builders/processing.rb +59 -0
  62. data/lib/imgproxy/version.rb +3 -1
  63. data/lib/imgproxy.rb +19 -57
  64. data/logo/logo-dark.svg +22 -0
  65. data/logo/logo-light.svg +31 -0
  66. metadata +70 -32
  67. data/lib/imgproxy/builder.rb +0 -140
  68. data/lib/imgproxy/options.rb +0 -119
  69. data/lib/imgproxy/options_aliases.rb +0 -45
@@ -0,0 +1,724 @@
1
+ <!--
2
+ # @title Supported processing options
3
+ -->
4
+ # Supported processing options
5
+
6
+ ### [resize](https://docs.imgproxy.net/usage/processing#resize)
7
+
8
+ ```ruby
9
+ {
10
+ resize: {
11
+ resizing_type: String || Symbol,
12
+ width: Integer,
13
+ height: Integer,
14
+ enlarge: true || false,
15
+ extend: extend, # See the 'extend' option
16
+ }
17
+ }
18
+ ```
19
+
20
+ ### [size](https://docs.imgproxy.net/usage/processing#size)
21
+
22
+ ```ruby
23
+ {
24
+ size: {
25
+ width: Integer,
26
+ height: Integer,
27
+ enlarge: true || false,
28
+ extend: extend, # See the 'extend' option
29
+ }
30
+ }
31
+ ```
32
+
33
+ ### [resizing_type](https://docs.imgproxy.net/usage/processing#resizing-type)
34
+
35
+ ```ruby
36
+ {
37
+ resizing_type: String || Symbol,
38
+ }
39
+ ```
40
+
41
+ ### [resizing_algorithm (pro)](https://docs.imgproxy.net/usage/processing#resizing-algorithm)
42
+
43
+ ```ruby
44
+ {
45
+ resizing_algorithm: String || Symbol,
46
+ }
47
+ ```
48
+
49
+ ### [width](https://docs.imgproxy.net/usage/processing#width)
50
+
51
+ ```ruby
52
+ {
53
+ width: Integer,
54
+ }
55
+ ```
56
+
57
+ ### [height](https://docs.imgproxy.net/usage/processing#height)
58
+
59
+ ```ruby
60
+ {
61
+ height: Integer,
62
+ }
63
+ ```
64
+
65
+ ### [min-width](https://docs.imgproxy.net/usage/processing#min-width)
66
+
67
+ ```ruby
68
+ {
69
+ "min-width": Integer,
70
+ }
71
+ ```
72
+
73
+ ### [min-height](https://docs.imgproxy.net/usage/processing#min-height)
74
+
75
+ ```ruby
76
+ {
77
+ "min-height": Integer,
78
+ }
79
+ ```
80
+
81
+ ### [zoom](https://docs.imgproxy.net/usage/processing#zoom)
82
+
83
+ ```ruby
84
+ {
85
+ zoom: {
86
+ zoom_x_y: Float
87
+ }
88
+ }
89
+ ```
90
+
91
+ ```ruby
92
+ {
93
+ zoom: {
94
+ zoom_x: Float
95
+ zoom_y: Float
96
+ }
97
+ }
98
+ ```
99
+
100
+ ### [dpr](https://docs.imgproxy.net/usage/processing#dpr)
101
+
102
+ ```ruby
103
+ {
104
+ dpr: Float,
105
+ }
106
+ ```
107
+
108
+ ### [enlarge](https://docs.imgproxy.net/usage/processing#enlarge)
109
+
110
+ ```ruby
111
+ {
112
+ enlarge: true || false,
113
+ }
114
+ ```
115
+
116
+ ### [extend](https://docs.imgproxy.net/usage/processing#extend)
117
+
118
+ ```ruby
119
+ {
120
+ extend: {
121
+ extend: true || false,
122
+ gravity: gravity, # See the 'gravity' option
123
+ }
124
+ }
125
+ ```
126
+
127
+ ### [extend_aspect_ratio](https://docs.imgproxy.net/usage/processing#extend_aspect_ratio)
128
+
129
+ ```ruby
130
+ {
131
+ extend_aspect_ratio: {
132
+ extend: true || false,
133
+ gravity: gravity, # See the 'gravity' option
134
+ }
135
+ }
136
+ ```
137
+
138
+ ### [gravity](https://docs.imgproxy.net/usage/processing#gravity)
139
+
140
+ ```ruby
141
+ {
142
+ gravity: {
143
+ type: String || Symbol,
144
+ x_offset: Float,
145
+ y_offset: Float,
146
+ }
147
+ }
148
+ ```
149
+
150
+ #### Special gravities
151
+
152
+ ```ruby
153
+ {
154
+ gravity: {
155
+ type: :fp,
156
+ x_offset: Float,
157
+ y_offset: Float,
158
+ }
159
+ }
160
+ ```
161
+
162
+ ```ruby
163
+ {
164
+ gravity: {
165
+ type: :sm,
166
+ }
167
+ }
168
+ ```
169
+
170
+ ```ruby
171
+ {
172
+ gravity: {
173
+ type: :obj,
174
+ class_names: Array[String || Symbol],
175
+ }
176
+ }
177
+ ```
178
+
179
+ ### [crop](https://docs.imgproxy.net/usage/processing#crop)
180
+
181
+ ```ruby
182
+ {
183
+ crop: {
184
+ width: Float,
185
+ height: Float,
186
+ gravity: gravity, # See the 'gravity' option
187
+ }
188
+ }
189
+ ```
190
+
191
+ ### [trim](https://docs.imgproxy.net/usage/processing#trim)
192
+
193
+ ```ruby
194
+ {
195
+ trim: {
196
+ threshold: Float,
197
+ color: String,
198
+ equal_hor: true || false,
199
+ equal_ver: true || false,
200
+ }
201
+ }
202
+ ```
203
+
204
+ ### [padding](https://docs.imgproxy.net/usage/processing#padding)
205
+
206
+ ```ruby
207
+ {
208
+ padding: {
209
+ top: Integer,
210
+ right: Integer,
211
+ bottom: Integer,
212
+ left: Integer,
213
+ }
214
+ }
215
+ ```
216
+
217
+ ### [auto_rotate](https://docs.imgproxy.net/usage/processing#auto-rotate)
218
+
219
+ ```ruby
220
+ {
221
+ auto_rotate: true || false
222
+ }
223
+ ```
224
+
225
+ ### [rotate](https://docs.imgproxy.net/usage/processing#rotate)
226
+
227
+ ```ruby
228
+ {
229
+ rotate: 90 || 180 || 270
230
+ }
231
+ ```
232
+
233
+ ### [background](https://docs.imgproxy.net/usage/processing#background)
234
+
235
+ ```ruby
236
+ {
237
+ background: {
238
+ r: Integer,
239
+ g: Integer,
240
+ b: Integer,
241
+ }
242
+ }
243
+ ```
244
+
245
+ ```ruby
246
+ {
247
+ background: {
248
+ hex_color: String,
249
+ }
250
+ }
251
+ ```
252
+
253
+ ### [background_alpha (pro)](https://docs.imgproxy.net/usage/processing#background-alpha)
254
+
255
+ ```ruby
256
+ {
257
+ background_alpha: Float
258
+ }
259
+ ```
260
+
261
+ ### [adjust (pro)](https://docs.imgproxy.net/usage/processing#adjust)
262
+
263
+ ```ruby
264
+ {
265
+ adjust: {
266
+ brightness: Integer,
267
+ contrast: Float,
268
+ saturation: Float,
269
+ }
270
+ }
271
+ ```
272
+
273
+ ### [brightness (pro)](https://docs.imgproxy.net/usage/processing#brightness)
274
+
275
+ ```ruby
276
+ {
277
+ brightness: Integer,
278
+ }
279
+ ```
280
+
281
+ ### [contrast (pro)](https://docs.imgproxy.net/usage/processing#contrast)
282
+
283
+ ```ruby
284
+ {
285
+ contrast: Float,
286
+ }
287
+ ```
288
+
289
+ ### [saturation (pro)](https://docs.imgproxy.net/usage/processing#saturation)
290
+
291
+ ```ruby
292
+ {
293
+ saturation: Float,
294
+ }
295
+ ```
296
+
297
+ ### [blur](https://docs.imgproxy.net/usage/processing#blur)
298
+
299
+ ```ruby
300
+ {
301
+ blur: Float,
302
+ }
303
+ ```
304
+
305
+ ### [sharpen](https://docs.imgproxy.net/usage/processing#sharpen)
306
+
307
+ ```ruby
308
+ {
309
+ sharpen: Float,
310
+ }
311
+ ```
312
+
313
+ ### [pixelate (pro)](https://docs.imgproxy.net/usage/processing#pixelate)
314
+
315
+ ```ruby
316
+ {
317
+ pixelate: Integer,
318
+ }
319
+ ```
320
+
321
+ ### [unsharp_masking (pro)](https://docs.imgproxy.net/usage/processing#unsharp_masking)
322
+
323
+ ```ruby
324
+ {
325
+ unsharp_masking: {
326
+ mode: String || Symbol,
327
+ weight: Float,
328
+ divider: Float,
329
+ }
330
+ }
331
+ ```
332
+
333
+ ### [blur_detections (pro)](https://docs.imgproxy.net/usage/processing#blur-detections)
334
+
335
+ ```ruby
336
+ {
337
+ blur_detections: {
338
+ sigma: Float,
339
+ class_names: Array[String || Symbol],
340
+ }
341
+ }
342
+ ```
343
+
344
+ ### [draw_detections (pro)](https://docs.imgproxy.net/usage/processing#draw-detections)
345
+
346
+ ```ruby
347
+ {
348
+ draw_detections: {
349
+ draw: true || false,
350
+ class_names: Array[String || Symbol],
351
+ }
352
+ }
353
+ ```
354
+
355
+ ### [gradient (pro)](https://docs.imgproxy.net/usage/processing#gradient)
356
+
357
+ ```ruby
358
+ {
359
+ gradient: {
360
+ opacity: Float,
361
+ color: String,
362
+ direction: String || Symbol,
363
+ start: Float,
364
+ stop: Float,
365
+ }
366
+ }
367
+ ```
368
+
369
+ ### [watermark](https://docs.imgproxy.net/usage/processing#watermark)
370
+
371
+ ```ruby
372
+ {
373
+ watermark: {
374
+ opacity: Float,
375
+ position: String || Symbol,
376
+ x_offset: Float,
377
+ y_offset: Float,
378
+ scale: Float,
379
+ }
380
+ }
381
+ ```
382
+
383
+ ### [watermark_url (pro)](https://docs.imgproxy.net/usage/processing#watermark-url)
384
+
385
+ ```ruby
386
+ {
387
+ watermark_url: String # Encoded to Base64 automatically
388
+ }
389
+ ```
390
+
391
+ ### [watermark_text (pro)](https://docs.imgproxy.net/usage/processing#watermark-text)
392
+
393
+ ```ruby
394
+ {
395
+ watermark_text: String # Encoded to Base64 automatically
396
+ }
397
+ ```
398
+
399
+ ### [watermark_size (pro)](https://docs.imgproxy.net/usage/processing#watermark-size)
400
+
401
+ ```ruby
402
+ {
403
+ watermark_size: {
404
+ width: Integer,
405
+ height: Integer,
406
+ }
407
+ }
408
+ ```
409
+
410
+ ### [watermark_shadow (pro)](https://docs.imgproxy.net/usage/processing#watermark-shadow)
411
+
412
+ ```ruby
413
+ {
414
+ watermark_shadow: Float
415
+ }
416
+ ```
417
+
418
+ ### [style (pro)](https://docs.imgproxy.net/usage/processing#style)
419
+
420
+ ```ruby
421
+ {
422
+ style: String # Encoded to Base64 automatically
423
+ }
424
+ ```
425
+
426
+ ### [strip_metadata](https://docs.imgproxy.net/usage/processing#strip-metadata)
427
+
428
+ ```ruby
429
+ {
430
+ strip_metadata: true || false,
431
+ }
432
+ ```
433
+
434
+ ### [keep_copyright](https://docs.imgproxy.net/usage/processing#keep-copyright)
435
+
436
+ ```ruby
437
+ {
438
+ keep_copyright: true || false,
439
+ }
440
+ ```
441
+
442
+ ### [dpi](https://docs.imgproxy.net/usage/processing#dpi)
443
+
444
+ ```ruby
445
+ {
446
+ dpi: Float,
447
+ }
448
+ ```
449
+
450
+ ### [strip_color_profile](https://docs.imgproxy.net/usage/processing#strip-color-profile)
451
+
452
+ ```ruby
453
+ {
454
+ strip_color_profile: true || false,
455
+ }
456
+ ```
457
+
458
+ ### [enforce_thumbnail](https://docs.imgproxy.net/usage/processing#enforce-thumbnail)
459
+
460
+ ```ruby
461
+ {
462
+ enforce_thumbnail: true || false,
463
+ }
464
+ ```
465
+
466
+ ### [quality](https://docs.imgproxy.net/usage/processing#quality)
467
+
468
+ ```ruby
469
+ {
470
+ quality: Integer,
471
+ }
472
+ ```
473
+
474
+ ### [format_quality](https://docs.imgproxy.net/usage/processing#format-quality)
475
+
476
+ ```ruby
477
+ {
478
+ format_quality: {
479
+ jpeg: Integer,
480
+ webp: Integer,
481
+ avif: Integer,
482
+ # etc...
483
+ }
484
+ }
485
+ ```
486
+
487
+ ### [autoquality](https://docs.imgproxy.net/usage/processing#autoquality)
488
+
489
+ ```ruby
490
+ {
491
+ autoquality: {
492
+ method: String || Symbol,
493
+ target: Float,
494
+ min_quality: Integer,
495
+ max_quality: Integer,
496
+ allowed_error: Float,
497
+ }
498
+ }
499
+ ```
500
+
501
+ ### [max_bytes](https://docs.imgproxy.net/usage/processing#max-bytes)
502
+
503
+ ```ruby
504
+ {
505
+ max_bytes: Integer,
506
+ }
507
+ ```
508
+
509
+ ### [jpeg_options (pro)](https://docs.imgproxy.net/usage/processing#jpeg-options)
510
+
511
+ ```ruby
512
+ {
513
+ jpeg_options: {
514
+ progressive: true || false,
515
+ no_subsample: true || false,
516
+ trellis_quant: true || false,
517
+ overshoot_deringing: true || false,
518
+ optimize_scans: true || false,
519
+ quant_table: Integer,
520
+ }
521
+ }
522
+ ```
523
+
524
+ ### [png_options (pro)](https://docs.imgproxy.net/usage/processing#png-options)
525
+
526
+ ```ruby
527
+ {
528
+ png_options: {
529
+ interlaced: true || false,
530
+ quantize: true || false,
531
+ quantization_colors: Integer,
532
+ }
533
+ }
534
+ ```
535
+
536
+ ### [webp_options (pro)](https://docs.imgproxy.net/usage/processing#webp-options)
537
+
538
+ ```ruby
539
+ {
540
+ webp_options: {
541
+ compression: String || Symbol,
542
+ }
543
+ }
544
+ ```
545
+
546
+ ### [format](https://docs.imgproxy.net/usage/processing#format)
547
+
548
+ ```ruby
549
+ {
550
+ format: String || Symbol
551
+ }
552
+ ```
553
+
554
+ ### [page (pro)](https://docs.imgproxy.net/usage/processing#page)
555
+
556
+ ```ruby
557
+ {
558
+ page: Integer
559
+ }
560
+ ```
561
+
562
+ ### [pages (pro)](https://docs.imgproxy.net/usage/processing#pages)
563
+
564
+ ```ruby
565
+ {
566
+ pages: Integer
567
+ }
568
+ ```
569
+
570
+ ### [disable_animation (pro)](https://docs.imgproxy.net/usage/processing#disable-animation)
571
+
572
+ ```ruby
573
+ {
574
+ disable_animation: true || false
575
+ }
576
+ ```
577
+
578
+ ### [video_thumbnail_second (pro)](https://docs.imgproxy.net/usage/processing#video-thumbnail-second)
579
+
580
+ ```ruby
581
+ {
582
+ video_thumbnail_second: Float
583
+ }
584
+ ```
585
+
586
+ ### [video_thumbnail_keyframes (pro)](https://docs.imgproxy.net/usage/processing#video-thumbnail-keyframes)
587
+
588
+ ```ruby
589
+ {
590
+ video_thumbnail_keyframes: true || false
591
+ }
592
+ ```
593
+
594
+ ### [video_thumbnail_tile (pro)](https://docs.imgproxy.net/usage/processing#video-thumbnail-tile)
595
+
596
+ ```ruby
597
+ {
598
+ video_thumbnail_tile: {
599
+ step: Float,
600
+ columns: Integer,
601
+ rows: Integer,
602
+ tile_width: Integer,
603
+ tile_height: Integer,
604
+ extend_tile: true || false,
605
+ trim: true || false,
606
+ }
607
+ }
608
+ ```
609
+
610
+ ### [fallback_image_url (pro)](https://docs.imgproxy.net/usage/processing#fallback-image-url)
611
+
612
+ ```ruby
613
+ {
614
+ fallback_image_url: String # Encoded to Base64 automatically
615
+ }
616
+ ```
617
+
618
+ ### [skip_processing](https://docs.imgproxy.net/usage/processing#skip-processing)
619
+
620
+ ```ruby
621
+ {
622
+ skip_processing: Array[String || Symbol]
623
+ }
624
+ ```
625
+
626
+ ### [raw](https://docs.imgproxy.net/usage/processing#raw)
627
+
628
+ ```ruby
629
+ {
630
+ raw: true || false
631
+ }
632
+ ```
633
+
634
+ ### [cachebuster](https://docs.imgproxy.net/usage/processing#cachebuster)
635
+
636
+ ```ruby
637
+ {
638
+ cachebuster: String || Symbol
639
+ }
640
+ ```
641
+
642
+ ### [expires](https://docs.imgproxy.net/usage/processing#expires)
643
+
644
+ ```ruby
645
+ {
646
+ expires: Integer || Time,
647
+ }
648
+ ```
649
+
650
+ ### [filename](https://docs.imgproxy.net/usage/processing#filename)
651
+
652
+ ```ruby
653
+ {
654
+ filename: String,
655
+ }
656
+ ```
657
+
658
+ ```ruby
659
+ {
660
+ filename: {
661
+ filename: String, # Encoded to Base64 automatically if :encoded is true
662
+ encoded: true || false,
663
+ }
664
+ }
665
+ ```
666
+
667
+ ### [return_attachment](https://docs.imgproxy.net/usage/processing#return-attachment)
668
+
669
+ ```ruby
670
+ {
671
+ return_attachment: true || false
672
+ }
673
+ ```
674
+
675
+ ### [preset](https://docs.imgproxy.net/usage/processing#preset)
676
+
677
+ ```ruby
678
+ {
679
+ preset: Array[String || Symbol]
680
+ }
681
+ ```
682
+
683
+ ### [hashsum](https://docs.imgproxy.net/usage/processing#hashsum)
684
+
685
+ ```ruby
686
+ {
687
+ hashsum: {
688
+ hashsum_type: Array[String || Symbol]
689
+ hashsum: String,
690
+ }
691
+ }
692
+ ```
693
+
694
+ ### [max_src_resolution](https://docs.imgproxy.net/usage/processing#max-src-resolution)
695
+
696
+ ```ruby
697
+ {
698
+ max_src_resolution: Float
699
+ }
700
+ ```
701
+
702
+ ### [max_src_file_size](https://docs.imgproxy.net/usage/processing#max-src-file-size)
703
+
704
+ ```ruby
705
+ {
706
+ max_src_file_size: Integer
707
+ }
708
+ ```
709
+
710
+ ### [max_animation_frames](https://docs.imgproxy.net/usage/processing#max-animation-frames)
711
+
712
+ ```ruby
713
+ {
714
+ max_animation_frames: Integer
715
+ }
716
+ ```
717
+
718
+ ### [max_animation_frame_resolution](https://docs.imgproxy.net/usage/processing#max-animation-frame-resolution)
719
+
720
+ ```ruby
721
+ {
722
+ max_animation_frame_resolution: Float
723
+ }
724
+ ```
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "uri"
4
+ require "yard"
5
+
6
+ module YARD
7
+ # Replaces <picture> tags with <img> and relative src with absolute ones
8
+ module ReplacePicture
9
+ def html_markup_markdown(text)
10
+ text = text.gsub(%r{<picture>.*(<img [^>]*>).*</picture>}m) do
11
+ Regexp.last_match(1)
12
+ end
13
+
14
+ text = text.gsub(/<img [^>]*src="(([^>?]+)(\?[^>]*)?)"[^>]*>/m) do |str|
15
+ src = Regexp.last_match(1)
16
+ next str unless URI.parse(src).relative?
17
+ str.gsub(src, url_for_file(Regexp.last_match(2)))
18
+ end
19
+
20
+ super(text)
21
+ end
22
+ end
23
+
24
+ Templates::Template.extra_includes << ReplacePicture
25
+ end