Quote from: sottwell at Jan 13, 2012, 12:59 AMphpthumbof 1.3.0, MODx Revo 2.2.0
As far as I can tell, setting the phpthumb_document_root in the system settings has no effect. By default it uses the $_SERVER['DOCUMENT_ROOT'] value.
Caches cleared, cookies cleared, nothing changes the config_document_root that the phpthumb class prepends to the filename it's passed.
An image TV has the base_path prepended to its media source path automatically. This mean that if a site is installed in a subdirectory the subdirectory name is being doubled.
/www/modx//modx/assets/images/image.png
Setting the phpthumb_document_root to something like /www should solve the problem, but it has no effect.
Sorry to revive a dead thread, but there's a few other threads about this exact problem, and most of them reference this thread.. So I though I'd post my workaround here. Having said that, it's a dirty-hack-workaround because it's very prone to breaking, but might solve some short term frustrations.
Basically in my error logs I have this:
[17] => ResolveFilenameToAbsolute() prepending $this->config_document_root (/srv/git/calwayinitial/cms/) to $filename (/calway/assets/slides/slide3.800.jpg) resulting in ($AbsoluteFilename = "/srv/git/reponame/cms//foo/assets/slides/slide3.800.jpg") in file "phpthumb.class.php" on line 1025
So phpthumbof is having a little trouble converting from url to absolute path (strange, because the rest of modx does that really well.. but anyway) the initial image call was:
which returned a url like:
/foo/assets/slides/slide3.800.jpg
we know that phpthumbof is just going to jam the core path ("/srv/git/reponame/cms/") infront of that.. and just hope it resolves to the correct absolute path.. so we just have to help it along.
You can chain output filters, so instead of a simple phpthumbof call:
[[+tv.slideImage:phpthumbof=`w=400&h=300`]]
just strip out the extraneous "/foo/" like so:
[[+tv.slideImage:stripString=`/foo/`:phpthumbof=`w=400&h=300`]]
So whilst this works, it will obviously break if that subdirectory name changes.