We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8830
    • 98 Posts

    I have a strange problem with a customer site.
    Using pThumb seems to generate the thumbs, but the snippet call generates an image path based on the server path and not the base url.

    Chunk: imageGalleryRow

    <li><a href="[[getImageSize:gt=`490`:then=`[[+image:phpthumbof=`w=490&zc=1`]]`:else=`[[+image]]`? &dimension=`width` &src=`[[+image]]`]]" class="fancybox" rel="group" title="[[+text]]"><img src="[[+thumbnail:is=``:then=`[[+image:phpthumbof=`w=160&h=160&zc=1`]]`:else=`[[+thumbnail]]`]]" alt=""></a></li>


    <li><a href="/customers/0/0/0/domain.net/httpd.www/assets/image-cache/Julshow.53697a56.jpg" class="fancybox" rel="group" title="Back stage at Onstage, Scandinavium"><img src="/customers/0/0/0/domain.net/httpd.www/assets/image-cache/Julshow.aca4c92f.jpg" alt=""></a></li>

    The image path in the TV "image" is correct, and the thumbnails are generated just fine. If I remove the "server path", using Developer tools, and only request the URL starting from "/assets..." the image is loaded in the frontend.
      • 8830
      • 98 Posts

      No clues why this happens?

      In phpthumbof.class.php I can find this:

      $this->config['cachePathUrl'] = str_replace(MODX_BASE_PATH, MODX_BASE_URL, $this->config['cachePath']);

      .. which is used for the URL generation/output, and is suposed to replace the MODX_BASE_PATH with MODX_BASE_URL. Seems correct. But the output is still based on MODX_BASE_PATH.
      • All my paths are usually like so:


        You might want to try the GitHub issues page and try & debug.
          • 8830
          • 98 Posts
          Yes, rx2, that is correct.
          My problem is that this path is prepended with the MODX_BASE_PATH, which should not be the case.
          I get the same problem whether I'm using the old style cache path in the settings (assets/components/phpthumbof), or the new pThumb cache path (assets/image-cache).
            • 8830
            • 98 Posts
            I've found the bug.

            The web host I'm using is using double slashes in one place in the BASE_PATH.

            pThumb does a string replace in the code of "//" to "/" to protect from misconfigured paths in MODX I guess.

            $this->config['cachePath'] = rtrim(str_replace('//', '/', $this->config['cachePath']), '/') . '/';  // just in case

            This breaks the string replace that creates the URL path later in the code.

            $cacheurl = rtrim($modx->getOption('phpthumbof.cache_url', null, MODX_BASE_URL), '/');
            $this->config['cachePathUrl'] = str_replace(MODX_BASE_PATH, "$cacheurl/", $this->config['cachePath']);

              • 50923
              • 137 Posts
              miomir.dancevic Reply #6, 8 years ago
              Have you find out the solution for this problem?
                <a href="www.play2web.com" title="izrada web sajtova">Izrada web sajtova</a>