We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 51347
    • 82 Posts
    Hello MODx Forum,

    is it possible to set "max. Filesize" for Image-Upload in the template variable?

    My wish:
    The tv "my-images" with input-settings "Image" has max.Filesize 2mb. If i try te upload 3mb picture "mypicture.jpg", i get error "Max. Imagesize 2mb!"


    best regards,
    Joe.
      • 37246
      • 128 Posts
      There are a few things that will affect uploading. They are, server limits, account limits (custom php.ini), then modx. You'll likely need to update your server's max upload size, then verify that modx's setting is adequate.
        I LOVE MODX! | greyskymedia.com
        • 18809
        • 109 Posts
        Just go to system setting and there, change the maximum upload size.
          My Proudly Powerd By Modx site - http://irresistiblemt.in smiley Its simple site but its made in best CMS.
          • 51347
          • 82 Posts
          Thank you for the answers!

          My problem is: i need the maximum-upload size for only one tv.

          Example: i need my system settings upload size 6mb but the image TV most have 2mb.
            • 3749
            • 24,544 Posts
            I don't think that's possible. AFAIK, there's no System Event for uploading images for a TV. You might check to see if the OnBeforeFileManagerUpload System Event fires in that case, but I don't think it does. If it does, it might be possible to do it with a plugin, but even then, it might not work.

            It would be a good feature request to add a size limit field for image TVs.
              Did I help you? Buy me a beer
              Get my Book: MODX:The Official Guide
              MODX info for everyone: http://bobsguides.com/modx.html
              My MODX Extras
              Bob's Guides is now hosted at A2 MODX Hosting
              • 51347
              • 82 Posts
              Thank you Bob,

              i will try it later with "OnBeforeFileManagerUpload". If that works, i will tell you that of course.
                • 5160
                • 118 Posts
                Depending on your setup you could allow files larger than 2mb to be uploaded to the TV and have a plugin resize the image once it's on the server.

                I published code to do this a while back, let me know if you need the link.

                Not sure if you could it to an event specific to the tv in question. This would affect other uploads well. You can get past the resizer using FTP if you need to larger image files in some cases.
                  • 51347
                  • 82 Posts
                  Hi Chris,

                  i think, that is what i need! Can you give me the link please?
                    • 5160
                    • 118 Posts
                    @joe-petts As requested privately Plugin to automatically resize images on upload is linked below. A couple of settings can be adjusted to suit your requirements and you need to manually configure the event you want to trigger the Plugin.

                    This hasn't been tested outside my own environment so no guarantees you won't need to tweak the code.

                    Note the Plugin is dependent on the Resizer Extra (see link in the code comments).

                    Let me know how you get on. I'd be interested to hear how compatible it is etc. as I might have a shot at packaging it up as an Extra for general release.

                    https://gist.github.com/chrisdempsey/39254982aeaba5a305d5339ff258fc70
                      • 51347
                      • 82 Posts
                      @chris.dempsey78

                      Thank you for your plugin!

                      I will try to install this plugin and let you of course know, if it work!