We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 20371
    • 58 Posts
    Just wondered how others were handling image resizing in articles?

    I've used phpthumbof fairly extensively where images are shown in specific locations, at pre-determined sizes. For example, resizing a banner image for different css media queries (viewport sizes).

    But that's not really possible in an article where a user could upload an image to to a media source and include it in an article or post. I know you can set px width and height in the tinyMCE image insert dialogue, but that's only the client side sizing. Obviously, if the user uploads a 2mb image (ok.. 5mb image?) from their camera, and inserts it in an article, it's going to ruin page load time.

    I'm sure it's a fairly common problem, I thought there would be a well used and celebrated plugin to handle this.. but I don't seem to be able to work out how everyone handles this issue?

    I noticed the autoFixImageSize addon, but it doesn't really come highly recommended in the thread about it on this forum. It seems like most users had either performance issue, resource spikes, or errors.

    So is there something I'm missing? Is there a commonly used plugin for this? Is there some workaround other than capping max_upload_size?
    • As far as I know there's not a really optimal way to do this at the moment. It looks like MODX 2.3 will have some nice improvements to the Manager and maybe more control over images in a rich-text editor will be one of them? It'd certainly be useful.

      For now you might take a look at extra I wrote to deal with this same problem, imageSlim. Its functionality is similar to autoFixImageSize, but I tried to address the performance problems and add some handy features as well. It offers multiple parameters for controlling image size and it's a snippet instead of a plugin, so once the page is cached there's zero performance hit.
      When the page is being built initially there's just the overhead of phpThumbOf, but there are a few tweaks to make that run a bit faster, especially on sites with large numbers of images. Also sometime I ought to add support for phpThumbsUp.
        Extras :: pThumbResizerimageSlimsetPlaceholders
        • 20371
        • 58 Posts
        Actually I just noticed imageSlim and gave it a go before reading your post. It's very impressive.


        • It just worked out of the box.
        • You're right about caching & performance.
        • You can specify which chunks / content to use it on.
        • Completely abstracts the process from the article writer

        So... it's solved the problem nicely IMO. Thanks very much. It's a shame you're not getting more love for this addon.
        • Hey great; glad it solved the problem for you!
          If you have any thoughts on features to add let me know.

          Last night I updated a section of the documentation with some tips for improving phpThumbOf performance generally and for fixing its file-naming bugs which in certain circumstances cause problems (missing, incorrect, or duplicate images).
            Extras :: pThumbResizerimageSlimsetPlaceholders