We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 2136
    • 134 Posts
    how would i go about making a contact form where the person has the ability to attach an image to the contact email? is there any way to automatically resize an image if it’s too big?

    thank you.
      Sorry - not using ModX anymore 01/01/2007
      • 11975
      • 2,542 Posts
      Hi,

      you can achieve the upload with eform

      with a form chunk like this one
      <p><span style="color:#900;">[+validationmessage+]</span></p>
      <form id="testForm" method="post" enctype="multipart/form-data">
      <input type="hidden" name="formid" value="testForm"/>
      <fieldset>
      <p>
      <label for="name">votre nom: </label><input type="text" name="nom" value="[+nom+]" eform="votre nom:String:1"/>
      </p>
      <p>
      <label for="prenom">votre prenom: </label><input type="text" name="prenom" eform="votre prenom:String:1"/>
      </p>
      </fieldset>
      <fieldset>
      <p>
      <label for="prenom">Joindre un fichier: </label><input type="file" name="fichierClient" eform="fichier:file:1"/>
      </p>
      </fieldset>
      
      <p>
      <input type="submit" value="test"/>
      </p>
      </form>
      
        Made with MODx : [url=http://www.copadel.com]copadel, fruits et l
        • 25663 MODX Staff
        • 12,272 Posts
        eForm supports file uploads, but it doesn’t handle resizing though; that would require custom work. For eForm, I like to use the modified parser version as it’s a lot easier for me anyway and is more flexible.
          Ryan Thrash, MODX Co-Founder
          Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
          • 2136
          • 134 Posts
          thanks very much. in lieu of doing custom work for resizing, is there a way to exclude files based on specific parameters, namely size?
            Sorry - not using ModX anymore 01/01/2007
            • 25663 MODX Staff
            • 12,272 Posts
            no because of the way the php/js solutions work it has no idea of knowing what the size is until after it’s been uploaded. and that’s frequently too late unfortunately.
              Ryan Thrash, MODX Co-Founder
              Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
              • 2136
              • 134 Posts
              ok - thanks for the info. i’ll definitely keep that in mind as we develop this idea.
                Sorry - not using ModX anymore 01/01/2007
                • 4041
                • 788 Posts
                arphaus,
                I have a simple uploader script that has a size limit setting, checks for resize (and does so if required) and creates the thumbnails. I can pack it up and post a copy if you want.
                  xforum
                  http://frsbuilders.net (under construction) forum for evolution
                  • 25663 MODX Staff
                  • 12,272 Posts
                  Nice breezer. smiley
                    Ryan Thrash, MODX Co-Founder
                    Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                    • 2136
                    • 134 Posts
                    wow - that would be fantastic!
                      Sorry - not using ModX anymore 01/01/2007
                      • 4041
                      • 788 Posts
                      attached is a zip which has 2 files, 1 for the snippet code and 1 for the image functions.

                      take the "SingleImageUploader.snippet.php" and use it for your snippet code, or tear it apart and use just the parts you need.

                      put the "image_functions.php" file somewhere on your server and adjust the path in the top of the snippet.

                      there are a few spots in the resize part which are still hard coded ( the max width and the new width required) but the code is simple to see what and where to modify. It is currently set up to create 88x89 pics.

                      any questions I’ll be glad to answer... smiley
                        xforum
                        http://frsbuilders.net (under construction) forum for evolution