Image+ with MIGX

Hi All,

I’ve set an image to image+ within MIGX which does show the crop function for the image but I need to set the aspect ratio within the MIGX formtabs field configuration and I have no idea how to do this, I currently have:

[{
    "caption": "Info",
    "fields": [{
        "field": "title",
        "caption": "Title"
      },
      {
        "field": "description",
        "caption": "Description",
        "inputTVtype": "richtext"
      }
    ]
  },
  {
    "caption": "Image",
    "fields": [{
      "field": "image",
      "caption": "Image",
      "inputTVtype": "imageplus"
 
    }]
  }
]

According to the docs I have to do the following but I keep breaking it:

If you want to use Image+ in MIGX you could define all Image+ TV properties with a JSON string in the Configs textarea in the MIGX formtabs field configuration. The following properties are possible:

{
"targetWidth":"",
"targetHeight":"",
"targetRatio":"",
"thumbnailWidth":"",
"allowAltTag":"",
"allowCaption":"",
"allowCredits":""
}

I’ve tried the following but I I say it breaks:

[{
    "caption": "Info",
    "fields": [{
        "field": "title",
        "caption": "Title"
      },
      {
        "field": "description",
        "caption": "Description",
        "inputTVtype": "richtext"
      }
    ]
  },
  {
    "caption": "Image",
    "fields": [{
      "field": "image",
      "caption": "Image",
      "inputTVtype": "imageplus"
 {
"targetRatio":"1.0"
}
    }]
  }
]

I’ve also tried adding the below to the Configurations box but it doesn’t seem to do anything:

 { "targetRatio":"1.85" }

And adding as a new line as below but it doesn’t seem to do anything:

[{
    "caption": "Info",
    "fields": [{
        "field": "title",
        "caption": "Title"
      },
      {
        "field": "description",
        "caption": "Description",
        "inputTVtype": "richtext"
      }
    ]
  },
  {
    "caption": "Image",
    "fields": [{
      "field": "image",
      "caption": "Image",
      "inputTVtype": "imageplus",
"targetRatio":"1.85"
 
    }]
  }
]

Could someone point out where I’m going wrong as I’m not the best with MIGX

Cheers

Maybe this works:

{
	"field":"image",
	"caption":"Image",
	"inputTVtype":"imageplus",
	"configs":{
		"targetRatio":1.85
	}
}

Thanks halftrainedharry but unfortunately that doesn’t set the aspect ratio either :frowning:

It seems to works when I create a configuration for the MIGX-TV but if I just put the json into the “Form Tabs:”-field (TV -> Tab “Input Options”) it doesn’t work.

Maybe you have to create a MIGX-configuration or an additional “Image+”-TV that you can reference in MIGX with “inputTV”.

Thanks halftrainedharry I’ll look into that and see if I can work it out :slight_smile:

Finally got it, your answer pointed me in the right direction, completed Form Tabs:

[{
    "caption": "Info",
    "fields": [{
        "field": "title",
        "caption": "Title"
      },
      {
        "field": "description",
        "caption": "Description",
        "inputTVtype": "richtext"
      }
    ]
  },
  {
    "caption": "Image",
    "fields": [{
      "field": "image",
      "caption": "Image",
      "inputTVtype": "imageplus",
"configs":"{\"targetRatio\":\"1.12\"}"
 
    }]
  }
]
1 Like

Thanks, but why the heck does the JSON of the options has to be escaped? Maybe you could open an issue in MIGX.

Hi jako,

No idea why the options need to be escaped but I found that solution from a post from 2018 or 17 on the old forums, how do I open an issue with MIGX ?

There is a repository on GitHub: https://github.com/Bruno17/MIGX

There is also info here, on how to use the tv configs in migx:

and there you also see the escaped json

"where": "[{\"isfolder: = \":\"1\"},{\"hidemenu\":\"0\",\"OR:hidemenu:=\":\"1\"}]"

The reason is, that that config is stored as a string inside the migx JSON, so the " need to be escaped or it will break the migx JSON

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.