# How to add multiple images for a gallery in a post using MIGX?

**URL:** <https://community.modx.com/t/how-to-add-multiple-images-for-a-gallery-in-a-post-using-migx/6737>\
**Category:** Development\
**Created:** [May 24, 2023, 5:40pm UTC](https://community.modx.com/t/how-to-add-multiple-images-for-a-gallery-in-a-post-using-migx/6737 "2023-05-24T17:40:58Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeffsydor](https://community.modx.com/user_avatar/community.modx.com/jeffsydor/32/363_2.png) [@jeffsydor](https://community.modx.com/u/jeffsydor)\
**Post date:** [May 24, 2023, 5:40pm UTC](https://community.modx.com/t/how-to-add-multiple-images-for-a-gallery-in-a-post-using-migx/6737/1 "2023-05-24T17:40:58Z")

</div>

I’m building a page of reviews for visitors to see. I’m using MIGX to create each individual post (i.e. Review title, description, contact info, etc.). But I only know how to add an individual image to each review, such as a post thumbnail using **“inputTVtype”: “image”**.

How can I add a series of images like this so that I can feature them as a gallery on each review? The only way I can think of this is to add them as images in a richtext format and then use javascript or something to extract the images and build the gallery. But there’s got to be an easier way of going about this.

I’ve always used inputTVtype, but maybe something with just inputTV?

Any help would be appreciated.

Thank you!

---

<div class="post-metadata">

**Author:** ![halftrainedharry](https://community.modx.com/user_avatar/community.modx.com/halftrainedharry/32/1063_2.png) [@halftrainedharry](https://community.modx.com/u/halftrainedharry)\
**Post date:** [May 24, 2023, 6:54pm UTC](https://community.modx.com/t/how-to-add-multiple-images-for-a-gallery-in-a-post-using-migx/6737/2 "2023-05-24T18:54:02Z")

</div>

You can nest MIGX grids. Inside your MIGX config for the reviews, use “migx” as the inputTVtype for the images and create another config for this.

---

<div class="post-metadata">

**Author:** ![vibedesign](https://community.modx.com/user_avatar/community.modx.com/vibedesign/32/741_2.png) [@vibedesign](https://community.modx.com/u/vibedesign)\
**Post date:** [May 25, 2023, 6:17am UTC](https://community.modx.com/t/how-to-add-multiple-images-for-a-gallery-in-a-post-using-migx/6737/3 "2023-05-25T06:17:14Z")

</div>

> [@halftrainedharry](#):
>
> Inside your MIGX config for the reviews, use “migx” as the inputTVtype for the images and create another config for this.

Do I understand this right, that you are setting `migx` as the `inputTVtype` within the parents migx json config? So you don’t have to create a separate TV but just another config with the same field (?) name in the migx CMP? If so, I never knew this was a thing…

* * *

I’ve always created a second migx TV and referred to that within the parent one, by including it as a `inputTV`. Just make sure your TV and your field name are not the same, as this will cause issues.

Then in the template of your parent `getImageList` call you can place another `getImageList` call but this time use the `&value` property instead of `&tvname` to refer to your field holding the nested TV:

```auto
[[getImageList?
  &value =[[+fieldname]] // field name that holds the nested TV

```

Here is also an [older thread](https://forums.modx.com/thread/90045/need-some-help-with-nested-migx) with an example.

---

<div class="post-metadata">

**Author:** ![halftrainedharry](https://community.modx.com/user_avatar/community.modx.com/halftrainedharry/32/1063_2.png) [@halftrainedharry](https://community.modx.com/u/halftrainedharry)\
**Post date:** [May 25, 2023, 8:00am UTC](https://community.modx.com/t/how-to-add-multiple-images-for-a-gallery-in-a-post-using-migx/6737/4 "2023-05-25T08:00:02Z")

</div>

> [@vibedesign](#):
>
> So you don’t have to create a separate TV but just another config with the same field (?) name in the migx CMP?

Yes, you don’t have to create a TV for the nested grid.

In the outer config (tab “Formtabs” → “Fields”) set “Input TV type” to `migx` **and “Configs” to the name of the nested MIGX configuration**.

---

<div class="post-metadata">

**Author:** ![bruno17](https://community.modx.com/user_avatar/community.modx.com/bruno17/32/71_2.png) [@bruno17](https://community.modx.com/u/bruno17)\
**Post date:** [May 25, 2023, 10:24am UTC](https://community.modx.com/t/how-to-add-multiple-images-for-a-gallery-in-a-post-using-migx/6737/5 "2023-05-25T10:24:47Z")

</div>

If this will get a lot of posts, I would store them into a custom table.  
This doesn’t work much different, than storing it all into a MIGX TV, but has many benefits.

---

<div class="post-metadata">

**Author:** ![jeffsydor](https://community.modx.com/user_avatar/community.modx.com/jeffsydor/32/363_2.png) [@jeffsydor](https://community.modx.com/u/jeffsydor)\
**Post date:** [May 25, 2023, 4:48pm UTC](https://community.modx.com/t/how-to-add-multiple-images-for-a-gallery-in-a-post-using-migx/6737/6 "2023-05-25T16:48:04Z")

</div>

This is very interesting, but I didn’t think I’d get it right on the first try. When I go to add an item, I’m just seeing a spinning wheel. I tried to do this in the Image Gallery. Here’s what I did:

````auto
[{
    "caption": "Review Info",
    "fields": [
      {
        "field": "reviewTitle",
        "validation": "required",
        "caption": "Title",
        "inputTVtype":"text"
      },
      {
        "field": "reviewCategory",
        "validation": "required",
        "caption": "Category",
        "inputTVtype":"listbox-multiple",
        "inputOptionValues": "Man||Bear||Pig",
        "configs":"{\"typeAhead\":true}"
      },
      {
        "field": "reviewDescription",
        "validation": "required",
        "caption": "Description of Work",
        "inputTVtype":"richtext"
      },
      {
        "field": "reviewGallery",
        "caption": "Image Gallery",
        "inputTVtype": "migx",
        "configs": [{
          "caption": "images",
          "fields": [
            {
              "field": "reviewImages",
              "caption": "Upload Images",
              "inputTVtype": "image"
            }
          ]
        }]
      }
    ]
  },
  {
    "caption": "Neighbor Info",
    "fields": [
      {
        "field": "reviewerAddress",
        "caption": "Neighbor Address",
        "inputTVtype": "text"
      },
      {
        "field": "reviewerPhone",
        "caption": "Neighbor Phone Number",
        "inputTVtype": "text"
      }

    ]
  },
  {
    "caption": "Contractor Info",
      "fields": [
        {
          "field": "reviewCompany",
          "validation": "required",
          "caption": "Company",
          "inputTVtype":"text"
      },
      {
          "field": "reviewCompanyAddress",
          "caption": "Company Address",
          "inputTVtype":"text"
      },
      {
          "field": "reviewCompanyPhone",
          "caption": "Company Phone Number",
          "inputTVtype":"text"
      },
      {
          "field": "reviewCompanyWeb",
          "caption": "Company Website",
          "inputTVtype":"text"
      }
    ]
  }
]```
````

---

<div class="post-metadata">

**Author:** ![jeffsydor](https://community.modx.com/user_avatar/community.modx.com/jeffsydor/32/363_2.png) [@jeffsydor](https://community.modx.com/u/jeffsydor)\
**Post date:** [May 25, 2023, 4:48pm UTC](https://community.modx.com/t/how-to-add-multiple-images-for-a-gallery-in-a-post-using-migx/6737/7 "2023-05-25T16:48:55Z")

</div>

is there a KB article somewhere for this? I’m not sure how to set that up.

thanks

---

<div class="post-metadata">

**Author:** ![halftrainedharry](https://community.modx.com/user_avatar/community.modx.com/halftrainedharry/32/1063_2.png) [@halftrainedharry](https://community.modx.com/u/halftrainedharry)\
**Post date:** [May 25, 2023, 5:12pm UTC](https://community.modx.com/t/how-to-add-multiple-images-for-a-gallery-in-a-post-using-migx/6737/8 "2023-05-25T17:12:48Z")

</div>

> [@jeffsydor](#):
>
> Here’s what I did:

Are you adding this JSON manually to the “Input Options” tab of the TV?  
Try using a MIGX configuration instead. (In the top menu “Extras” → “MIGX”).

* * *

> [@jeffsydor](#):
>
> is there a KB article somewhere for this? I’m not sure how to set that up.

I made [this video](https://www.youtube.com/watch?v=etWGLiS7124), that shows the process.
