We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 53390
    • 42 Posts
    Hi,
    do you have experience of resizing images with the phpThumbOf extra? Generally, I am curious what is the faster way of loading a page whether saving my own low-res thumbs and listing them with phpThumOf or use phpThumbOf server-side resizing? By the way, does the phpThumbOf generates a thumb and saves it permanently on a server or is it just a runtime process which is performed each time images are listed and cleared when session is ended?

    This question has been answered by multiple community members. See the first response.

    • discuss.answer
      • 4172
      • 5,888 Posts
      I would replace phpthumbof with pthumb. It is newer and better.
      Both autocreate the thumbs once at runtime and save them permanently.
      pthumb tries to fetch the saved thumb, if not found, it creates a new one.
      You don't need to upload your own lo-res thumbs.

      There are also ways to autocreate thumbnails with different sizes at upload with plugins.
      MIGX has a plugin like that included.
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
      • discuss.answer
        • 53390
        • 42 Posts
        Is pThumb a separate extra?
        I can't see any pThumb in the list of extras available online in ModX Docs here: https://docs.modx.com/extras/revo/

        MIGX plugin. Is this the one: migxResizeOnUpload
        Do I need to use original parameter (resize the original)?
        If I decided, for any reason, to change the size of thumbnails, would I need to reupload them in this case?

        p.s. I think these FAQ should be added to documentation for each extra to avoid similar silly questions in future. smiley
        • discuss.answer
          • 4172
          • 5,888 Posts
          not all Extras are listed in the Documentation.
          https://modx.com/extras/package/pthumb

          And yes, if you want to create resized images with migxResizeOnUpload you will need to reupload them.
          Of course, a script could be created, which would do mass-resizing.
          That's why I'm using pthumb, when I don't know the needed sizes at upload-time.
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 53390
            • 42 Posts
            I have installed pThumb but can't make it work the way I need. I expect it to create thumbnails as copies of original resolution images. But it's not creating anything. I have a div container for images so I put everything in a new chunk and try calling pthumb from that chunk. Doesn't matter whether I put it directly to migx tag or through the chunk it doesn't work. Migx is working fine as it provides data arrays for each image in an album, pthumb works only that it renders scaled down original images but no thumbnails created as new files to be reused as proxies. Either a hyperlink or a thumbnail is basically the same hi-res image.
            My template looks like this:
            [[!migxLoopCollection?
            &packageName=`migxgallery`
            &classname=`migxGallery`
            &sortConfig=`[{"sortby":"title","sortdir":"ASC"}]`
            &where=`{"resource_id":"[[*id]]","published":"1"}`
            &tpl=`@CODE:[[$migxGalleryThumbs]]`
            ]]
            

            migxGalleryThumbs chunk:
            <a href="[[+image]]"><div class="thumbnail_block">
            <img class="thumbnail_img" src="[[!pthumb? &input=`[[+image]]` &useResizer=`1` &options=`w=160 &h=140 &zc=1 &q=50`]]" />
            <div class="thumbnail_title">[[+title]]</div>
            </div></a>
            

            "+image" gives original image, +title gives the title, and I think &input gives the same original image that's why it is showing images and sizes are defines by css rather than this &options parameter.
            I tried to use an example code from documentation:
            [[*thumbnailImage:phpthumbof=`w=160&h=140&zc=1`]]

            but this one doesn't do anything. Not even listing thumbs just generating empty image tags:
            <img src="" />


            Any ideas why is that?
            Thanks.
            • discuss.answer
              • 4172
              • 5,888 Posts
              this is the way, how you call the tpl-chunk, usually. Does this change anything?

              &tpl=`migxGalleryThumbs`
                -------------------------------

                you can buy me a beer, if you like MIGX

                http://webcmsolutions.de/migx.html

                Thanks!
                • 53390
                • 42 Posts
                Thank you so much Bruno,
                it seems to be doing something now. I can see that html <img> tag src is coming from a phpthumbof chache directory and if I right-click on the image and choose "view image" it shows a low-res version GREAT!!! That's what it should be. I spent hours trying different ways but didn't try the simplest smiley The only question is that I still don't have any real file copies in the original gallery directory something like "image001_thumb" or whatever. Is it suppose to keep the thumbnails in cache and what happens when the gallery has many images, does the cache gets overloaded and etc? I mean, what is the workflow for pThumb here?

                B.t.w. Is it here an option to hide the real gallery image source path? I saw in documentation something about hashing paths is it the right field for that to be studied further?