svg2img 0.1.1-arm64-darwin → 0.2.0-arm64-darwin
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.
- checksums.yaml +4 -4
- data/README.md +7 -2
- data/lib/svg2img/3.2/svg2img.bundle +0 -0
- data/lib/svg2img/3.3/svg2img.bundle +0 -0
- data/lib/svg2img/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9212050550eed8ed65cdbcbf3c026044f49f2812d91da62182ee22fc0a60a641
|
4
|
+
data.tar.gz: 0b7fe777e6ae87e7f0a37894de5762d5a7dd9fbf04c788df29b68ed53555bb45
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d3973273fe4630e75f1d9a3e480c308d844d147a3e52a18284dd1e6f35b438071ec45a1fb93911708593675a4fe35dff1c250f81edb7803333b985d7e239b40b
|
7
|
+
data.tar.gz: 9053eeb34df6ff0e4c4416c82265698268729477da3a23a94876c9dadad016eedc864ccf94941660fc0155c05bac73472db11f091de500f556307fbb1955e4ac
|
data/README.md
CHANGED
@@ -50,12 +50,12 @@ circle_svg = <<~SVG
|
|
50
50
|
<circle cx="50" cy="50" r="40" stroke="black" stroke-width="3" fill="red" />
|
51
51
|
</svg>
|
52
52
|
SVG
|
53
|
-
png_path = Svg2Img.process_svg(circle_svg,
|
53
|
+
png_path = Svg2Img.process_svg(circle_svg, format: :png)
|
54
54
|
# png_path is a path to the generated PNG file
|
55
55
|
|
56
56
|
# Rails example
|
57
57
|
data = Rails.cache.fetch([some, deps]) do
|
58
|
-
png_path = Svg2Img.process_svg(circle_svg,
|
58
|
+
png_path = Svg2Img.process_svg(circle_svg, format: :png, size: proc {|_svg_width, _svg_height| [256, 256]})
|
59
59
|
png_data = File.binread(png_path)
|
60
60
|
File.delete(png_path)
|
61
61
|
png_data
|
@@ -63,6 +63,11 @@ end
|
|
63
63
|
send_data(png_data, type: 'image/png', disposition: 'inline')
|
64
64
|
```
|
65
65
|
|
66
|
+
### Options
|
67
|
+
|
68
|
+
- `format` - output format, one of `:png`, `:jpg`, `:webp`, `:gif`
|
69
|
+
- `size` - size of the output image as a proc that receives the width and height of the SVG and returns an array with the width and height of the output image. If the provides size has a different aspect ratio than the SVG, the image will be resized to fit in the center of the provided size. If not provided, the output image will have the same size as the SVG.
|
70
|
+
|
66
71
|
## Development
|
67
72
|
|
68
73
|
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
Binary file
|
Binary file
|
data/lib/svg2img/version.rb
CHANGED