We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3766
    • 4 Posts
    Hi,
    do you know if there’s a way to see a thumbnail preview of image TVs in the manager? In modx Evo, that was possible via the managermanager plugin, but I can’t find a way of doing that in Revo

    thanks,
    Pietro
      • 23491 ☆ A M B ☆
      • 1,056 Posts
      Yes, it is indeed possible. It generally works "out of the box", but that is not always the case based on your settings/setup.

      For example, I am currently running on MODx 2.0.8 install where Image Preview and Thumbnails are not showing up at all. Investigating this issue, I go to "Report > Error Log" and noticed that PHPThumb is having a problem creating the thumbnails:

      Quote from: "MODx

      [2011-03-16 21:01:17] (ERROR @ /~username/connectors/system/phpthumb.php) phpThumb was unable to generate a thumbnail for: /home/username/public_html/core/cache/phpthumb/phpThumb_cache_111.222.333.444_src20746b5215d87d452040ee8ac24304e0_paradf896d45f319fa323d889e84ccb98c5_dat1300284101.jpeg
      [2011-03-16 21:01:17] (ERROR @ /~username/connectors/system/phpthumb.php) Error outputting thumbnail: OutputThumbnail() failed because !is_resource($this->gdimg_output) in file "phpthumb.class.php" on line 557
      [2011-03-16 21:01:26] (ERROR @ /~username/connectors/system/phpthumb.php) phpThumb was unable to generate a thumbnail for: /home/username/public_html/core/cache/phpthumb/phpThumb_cache_111.222.333.444_src20746b5215d87d452040ee8ac24304e0_paradf896d45f319fa323d889e84ccb98c5_dat1300284101.jpeg
      [2011-03-16 21:01:26] (ERROR @ /~username/connectors/system/phpthumb.php) Error outputting thumbnail: OutputThumbnail() failed because !is_resource($this->gdimg_output) in file "phpthumb.class.php" on line 557

      NOTE: 111.222.333.444 is a masked development IP address running on a shared hosting provider setup.

      Originally I thought the issue may have had something to do with PHPThumb, but I was able to create a working example manually:

      MODx Manager generated HTML (No image, PHPThumb throws error):
      http://111.222.333.444/~username/connectors/system/phpthumb.php?h=150&w=150&HTTP_MODAUTH=modx_____________&src=images/example.jpg


      Manual PHPThumb Connector Test (Image thumb works! Note the full URL source):
      http://111.222.333.444/~username/connectors/system/phpthumb.php?h=150&w=150&HTTP_MODAUTH=modx_____________&src=http://111.222.333.444/~username/images/example.jpg
      


      I am really confused why the thumbs aren’t showing up, as they do in my other setups. Further, the filemanager settings are also the same:

      filemanager_path = (empty)
      filemanager_path_relative = Yes
      filemanager_url = (empty)
      filemanager_url_relative = Yes

      My conclusion is that clearly PHPThumb works if it can find the actual source image. For some reason (given my current settings) I cannot get this to work within the MODx Manager. Perhaps you can check your MODx Error Log and look for similar errors?


      Update:

      After some more searching, I came across a previously filed bug that sounded exactly like what I was experiencing: http://bugs.modx.com/issues/54 Unfortunately, the bug was closed as it was not able to be reproduced.

      Digging a little deeper, I double checked the output of $_SERVER[’DOCUMENT_ROOT’], and sure enough this is NOT the correct document root for this MODx instance.

      $_SERVER[’DOCUMENT_ROOT’] = /usr/local/apache/htdocs (this is not right, looks to be the default apache path)

      My expected DOCUMENT_ROOT should be /home/username/public_html.

      So, following the method mentioned in the bug report, I simply changed Line 219 in core/model/phpthumb/phpthumb.class.php:

      From:
      $this->config_document_root = (@$_SERVER['DOCUMENT_ROOT'] ? $_SERVER['DOCUMENT_ROOT'] : $this->config_document_root);

      To:
      $this->config_document_root = (@$_SERVER['DOCUMENT_ROOT'] ? '/home/username/public_html' : $this->config_document_root);


      ...and it worked! Now all my Image TV Previews and Filemanager thumbnails are working without issue! smiley

      My thanks goes out to Jonas Ingenerf for posting his temporary solution. Hopefully there is a more proper way to go about this solution without editing core files...
        Mike Reid - www.pixelchutes.com
        MODx Ambassador / Contributor
        [Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
        ________________________________
        Where every pixel matters.
        • 18373 ☆ A M B ☆
        • 3,141 Posts
        Just as a followup.. the bug pixelchutes refers to was reopened and a system setting has been added to overwrite the documentroot without hacking into the core smiley

        You’ll be able of using that fix in the 2.1 release.. applying the commit to 2.0.x releases wont work iirc.
          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.
          • 3927
          • 16 Posts
          The prepend site url setting is working for me. I have been debugging for hours, until I saw this one in system settings. Thanks developers for adding this setting
            • 40748
            • 55 Posts
            Hi!

            I have almost the same problem with phpThumb:
            "(ERROR @ /assets/components/gallery/connector.php) [phpThumbOf] Could not generate thumbnail: ......"

            But visually in the backend and at the frontend I see all images (almost all images!).

            I'd like to clarify what if system setting "phpthumb_document_root" does the same what you described below?


            Update:

            After some more searching, I came across a previously filed bug that sounded exactly like what I was experiencing: http://bugs.modx.com/issues/54 Unfortunately, the bug was closed as it was not able to be reproduced.

            Digging a little deeper, I double checked the output of $_SERVER['DOCUMENT_ROOT'], and sure enough this is NOT the correct document root for this MODx instance.

            $_SERVER['DOCUMENT_ROOT'] = /usr/local/apache/htdocs (this is not right, looks to be the default apache path)

            My expected DOCUMENT_ROOT should be /home/username/public_html.

            So, following the method mentioned in the bug report, I simply changed Line 219 in core/model/phpthumb/phpthumb.class.php:

            From:
            $this->config_document_root = (@$_SERVER['DOCUMENT_ROOT'] ? $_SERVER['DOCUMENT_ROOT'] : $this->config_document_root);

            To:
            $this->config_document_root = (@$_SERVER['DOCUMENT_ROOT'] ? '/home/username/public_html' : $this->config_document_root);


            ...and it worked! Now all my Image TV Previews and Filemanager thumbnails are working without issue! smiley

            My thanks goes out to Jonas Ingenerf for posting his temporary solution. Hopefully there is a more proper way to go about this solution without editing core files...
              Cheap and ready landing pages: http://real-portal.biz
              Start selling fast, good for dropshipping
              • 41970
              • 79 Posts
              Just wanted to throw in another possible cause of this problem:
              Make sure your folder names don't contain any spaces or characters like $, %, & etc.! I made that mistake and my image tv thumbs didn't show up. Once I changed the folder names, and I chose the images with missing thumbs again, it was fine!