# Introducing image grids in posts

**URL:** <https://meta.discourse.org/t/introducing-image-grids-in-posts/268664>\
**Category:** Announcements\
**Tags:** new-feature\
**Created:** [June 19, 2023, 6:46pm UTC](https://meta.discourse.org/t/introducing-image-grids-in-posts/268664 "2023-06-19T18:46:03Z")\
**Posts on this page:** 1\
**Showing post:** 13

<div class="post-metadata">

**Author:** ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)\
**Post date:** [June 22, 2023, 8:11am UTC](https://meta.discourse.org/t/introducing-image-grids-in-posts/268664/13 "2023-06-22T08:11:46Z")

</div>

Hi bart 👋

This should work. Obviously, do a backup and carefully look for any unwanted results in the previous masonry posts… 🙂

```rb
posts = Post.where('raw LIKE ?', '%<div data-masonry-gallery>%')

posts.each do |p|
    p.update!(raw: p.raw.gsub(/<div data-masonry-gallery>(.*?)<\/div>/m, '[grid]\1[/grid]'))
    p.rebake!
end

```

---

_[View the full topic](https://meta.discourse.org/t/introducing-image-grids-in-posts/268664)._
