OK I have found a solution but is is a major hack!
So I visited /connectors/system/phpthumb.php and found the following code:
<?php
/**
* @var modX $modx
* @package modx
*/
require_once dirname(dirname(__FILE__)).'/index.php';
$_SERVER['HTTP_MODAUTH'] = $modx->user->getUserToken($modx->context->get('key'));
$modx->request->handleRequest(array('location' => 'system','action' => 'phpthumb'));
If figured if the Gallery modules functionality was working and the above code wasn't then maybe I could make this file go through the Gallerys phpthumb process. So I found the connector for the gallery (assets/components/gallery/connector.php), tweaked some of its code and copied it into "/connectors/system/phpthumb.php"
So now my file at /connectors/system/phpthumb.php looks like this:
<?php
/**
* @var modX $modx
* @package modx
*/
require_once dirname(dirname(__FILE__)).'/index.php';
//force the url action to always be web/phpthumb
$_REQUEST['action'] = 'web/phpthumb';
if (!empty($_REQUEST['action']) && $_REQUEST['action'] == 'web/phpthumb') {
@session_cache_limiter('public');
define('MODX_REQP',false);
}
require_once dirname(dirname(__FILE__)).'/config.core.php';
require_once MODX_CORE_PATH.'config/'.MODX_CONFIG_KEY.'.inc.php';
require_once MODX_CONNECTORS_PATH.'index.php';
$galleryCorePath = $modx->getOption('gallery.core_path',null,$modx->getOption('core_path').'components/gallery/');
require_once $galleryCorePath.'model/gallery/gallery.class.php';
$modx->gallery = new Gallery($modx);
$modx->lexicon->load('gallery:default');
if ($_REQUEST['action'] == 'web/phpthumb') {
$version = $modx->getVersionData();
if (version_compare($version['full_version'],'2.1.1-pl') >= 0) {
if ($modx->user->hasSessionContext($modx->context->get('key'))) {
$_SERVER['HTTP_MODAUTH'] = $_SESSION["modx.{$modx->context->get('key')}.user.token"];
} else {
$_SESSION["modx.{$modx->context->get('key')}.user.token"] = 0;
$_SERVER['HTTP_MODAUTH'] = 0;
}
} else {
$_SERVER['HTTP_MODAUTH'] = $modx->site_id;
}
$_REQUEST['HTTP_MODAUTH'] = $_SERVER['HTTP_MODAUTH'];
}
/* handle request */
$path = $modx->getOption('processorsPath',$modx->gallery->config,$galleryCorePath.'processors/');
$modx->request->handleRequest(array(
'processors_path' => $path,
'location' => '',
));
And how it works perfectly.
Note: If you are having the same problem then you will need to make sure that the gallery plugin has been installed. I am currently running Modx Revo 2.2.6-pl and the gallery plugin that I have installed is 1.5.2 (pl). I also have phpThumbOf 1.4.0 (pl) installed but I don't think that this plugin is involved in this fix in any way as Gallery appears to have its own phpthumb configuration.