We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10713
    • 41 Posts
    Please let me know if you experience serious performance problems! I’d love to improve the plugin!
      • 16337
      • 44 Posts
      i just noticed something - i have a small image on the template (26x32px - see attach) and AFIS want to resize it to 27x32px. is it a rounding or some other issue?

      i also have an idea - how about limiting the image search to a specific <div>?
      say only within <div class="maincontent"></div>
        • 10713
        • 41 Posts
        Quote from: krisj at May 20, 2011, 07:19 AM

        i just noticed something - i have a small image on the template (26x32px - see attach) and AFIS want to resize it to 27x32px. is it a rounding or some other issue?
        You should use such kind of images as a CSS background image, because it’s presentational only, no content.
        Besides that, I can’t explain. The plugin compares the written values in width="" and height="" attributes with the physical size, taken from the PHP function getimagesize() ...

        Quote from: krisj at May 20, 2011, 07:19 AM

        i also have an idea - how about limiting the image search to a specific <div>?
        say only within <div class="maincontent"></div>

        That would require some additional Regular Expressions and HTML parsing. Not as easy as it sounds in the first moment... I’ll think about it.
          • 16337
          • 44 Posts
          Quote from: gerritvanaaken at May 20, 2011, 10:13 AM

          Quote from: krisj at May 20, 2011, 07:19 AM

          i just noticed something - i have a small image on the template (26x32px - see attach) and AFIS want to resize it to 27x32px. is it a rounding or some other issue?
          You should use such kind of images as a CSS background image, because it’s presentational only, no content.
          Besides that, I can’t explain. The plugin compares the written values in width="" and height="" attributes with the physical size, taken from the PHP function getimagesize() ...

          Well, I wouldnt discount icon size images as not suitable for content. people generate all sorts of content...

          maybe there is some sort of a bug in the way php is reading the image dimension in small files.

          Quote from: gerritvanaaken at May 20, 2011, 10:13 AM

          Quote from: krisj at May 20, 2011, 07:19 AM

          i also have an idea - how about limiting the image search to a specific <div>?
          say only within <div class="maincontent"></div>

          That would require some additional Regular Expressions and HTML parsing. Not as easy as it sounds in the first moment... I’ll think about it.

          no pressure wink and if it doesnt make it faster, then why bother.
            • 16337
            • 44 Posts
            discovered a little bug - when I use external images in the content eg: http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif

            it will also throw an error. i wonder what would be the best way to treat this?

            skip the external img altogether?
              • 10713
              • 41 Posts
              I did not think about this before. Yes, I’ll need to skip external images.

              update: New version is in the Package Management!
                • 30107
                • 44 Posts
                Very useful & elegant plugin!

                I noticed that my clients often just set the "width"-value of the <img>-tag when using TinyMCE. The images don’t get resized then. I changed the plugin code at line 40:

                // if resizing needed...
                if ($width && $height && ($dimensions[0] != $width || $dimensions[1] != $height)) {


                to

                // if resizing needed...
                if (($width || $height) && ($dimensions[0] != $width || $dimensions[1] != $height)) {


                Seems to work so far. Gerrit, do you expect problems with that?
                  • 18373 ☆ A M B ☆
                  • 3,141 Posts
                  Quote from: gerritvanaaken at May 30, 2011, 05:30 AM

                  I did not think about this before. Yes, I’ll need to skip external images.

                  update: New version is in the Package Management!

                  You could set system settings to also allow off-site use of phpthumb IIRC.

                  Perhaps it could become a plugin setting at a later release to also include external images (with a note on how to modify the required phpthumb settings)? If they start linking to external images and resizing them, I can definitely see a use in that.
                    Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

                    Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
                    • 10713
                    • 41 Posts
                    @titanium Yea, that’s a good point! I’ll change that for the next RC!

                    @Mark H: Is this [[++setting_phpthumb_nohotlink_enabled]] ?

                    I’m not sure if getimagesize() works smoothly with external images...
                    http://php.net/manual/de/function.getimagesize.php

                    Need to test this, although I’m not sure if it’s the very best idea to support editors at hotlinking/copying images from remote locations...
                      • 16337
                      • 44 Posts
                      it should work fine with external images. there might be more reliable and or performant alternatives though. perhaps something out of imagemagick’s toolset?

                      but using external images in general i think is something that should be considered very carefully.

                      one major use case is CDN. anyone played around with this yet?

                      another use case is images on subdomains for working around concurrency limitations in browsers. that why a configurable external ignore/filet option would be very useful.