We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 24374
    • 322 Posts
    Is there a way to specify a minimum image width in MIGX? How about when using ImagePlus for the image field?

    This question has been answered by rainbowtiger. See the first response.

      • 28432
      • 372 Posts
      You can restrict targetWidth or targetHeight or targetRatio or thumbnailWidth and allowAltTag directly in the form tab config of Migx like this :
      [
      {"caption":"Informations", "fields": [
          {"field":"title","caption":"Titre de l'image"},
          {"field":"image","caption":"Image","inputTVtype":"imageplus","configs":"{ \"targetWidth\":\"800\", \"targetHeight\":\"600\" }"}
      ]}
      ]


      All properties available are :
      {
      "targetWidth":"",
      "targetHeight":"",
      "targetRatio":"",
      "thumbnailWidth":"",
      "allowAltTag":""
      }

      You can find it here http://jako.github.io/ImagePlus/examples/#migx [ed. note: Steeve last edited this post 7 years, 9 months ago.]
        • 24374
        • 322 Posts
        Hmm. I tried this, but it didn't work. I got no alert when inserting a smaller photo than the declared targetWidth and targetHeight.
        • discuss.answer
          • 24374
          • 322 Posts
          No, it didn't work before. I posted that before testing it.

          I found the issue. I entered the JSON into the config by copying and pasting this:
          {
          "targetWidth":"",
          "targetHeight":""
          }

          But the JSON string, when copying using "Edit raw" inserts "\n" where there are line feeds, which makes it not work. I removed the line breaks, recopied and pasted the JSON, and now it works.
            • 28432
            • 372 Posts
            Quote from: rainbowtiger at Jul 31, 2016, 01:03 AM
            No, it didn't work before. I posted that before testing it.

            I found the issue. I entered the JSON into the config by copying and pasting this:
            {
            "targetWidth":"",
            "targetHeight":""
            }

            But the JSON string, when copying using "Edit raw" inserts "\n" where there are line feeds, which makes it not work. I removed the line breaks, recopied and pasted the JSON, and now it works.

            i'm glad it work for you now!