Skip to content

Commit 90ab956

Browse files
committed
feat(images-instructions): re name instructions and include shrine explication
1 parent 14eb6f6 commit 90ab956

File tree

2 files changed

+53
-25
lines changed

2 files changed

+53
-25
lines changed

docs/images.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Images Integration
2+
3+
## Paperclip
4+
5+
### Image Row
6+
7+
```ruby
8+
show do
9+
attributes_table do
10+
image_row :photo
11+
end
12+
end
13+
```
14+
15+
<img src="./images/paperclip-image-row.png" height="400" />
16+
17+
### Image Column
18+
19+
```ruby
20+
index do
21+
image_column :photo, style: :thumb
22+
end
23+
```
24+
25+
<img src="./images/paperclip-image-column.png" height="400" />
26+
27+
> You can pass `style` attribute matching paperclip's style definition
28+
29+
## Shrine
30+
31+
### Image Row
32+
33+
The Shrine implementation receives an optional `image_options` which is then used as the options for the [`image_tag`](https://apidock.com/rails/ActionView/Helpers/AssetTagHelper/image_tag) method.
34+
```ruby
35+
show do
36+
attributes_table do
37+
image_row :photo, image_options: { width: 400 }
38+
end
39+
end
40+
```
41+
42+
<img src="./images/paperclip-image-row.png" height="400" />
43+
44+
### Image Column
45+
46+
To use the Shrine [derivatives](https://shrinerb.com/docs/plugins/derivatives) you can use the `style` option with the name of the derivative like the example below. In this case you would need to have a derivative created with the `'jpg_small'` name.
47+
```ruby
48+
index do
49+
image_column :photo, style: :jpg_small
50+
end
51+
```
52+
53+
<img src="./images/paperclip-image-column.png" height="400" />

docs/paperclip_images.md

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)