Skip to content

Commit

Permalink
feat(images-instructions): re name instructions and include shrine ex…
Browse files Browse the repository at this point in the history
…plication
  • Loading branch information
GabrielLyonB committed Apr 8, 2022
1 parent 14eb6f6 commit 90ab956
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 25 deletions.
53 changes: 53 additions & 0 deletions docs/images.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Images Integration

## Paperclip

### Image Row

```ruby
show do
attributes_table do
image_row :photo
end
end
```

<img src="./images/paperclip-image-row.png" height="400" />

### Image Column

```ruby
index do
image_column :photo, style: :thumb
end
```

<img src="./images/paperclip-image-column.png" height="400" />

> You can pass `style` attribute matching paperclip's style definition
## Shrine

### Image Row

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.
```ruby
show do
attributes_table do
image_row :photo, image_options: { width: 400 }
end
end
```

<img src="./images/paperclip-image-row.png" height="400" />

### Image Column

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.
```ruby
index do
image_column :photo, style: :jpg_small
end
```

<img src="./images/paperclip-image-column.png" height="400" />
25 changes: 0 additions & 25 deletions docs/paperclip_images.md

This file was deleted.

0 comments on commit 90ab956

Please sign in to comment.