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!
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...