http://domain.tld/connectors/system/phpthumb.php?src=/var/www/upload/phpK9Dc5d.gif&w=300&h=300&f=gif&q=90
{'success':false,'code':401}(Aka, error 401 Unauthorized Access)
$downSizeQuery = http_build_query(
array(
'src' => "/var/www/upload/" . $moved['filename'],
'w' => $downSizeWidth,
'h' => $downSizeHeight,
'f' => $ext,
'q' => $downSizeQuality,
), '', '&');
$ch = curl_init ($this->ctx->getOption('site_url') . "connectors/system/phpthumb.php?" . urldecode($downSizeQuery));
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_BINARYTRANSFER,1);
$rawdata=curl_exec($ch);
curl_close ($ch);This question has been answered by Mr5o1. See the first response.
'HTTP_MODAUTH' => $this->xpdo->user->getUserToken($this->xpdo->context->get('key')),
'wctx' => $this->ctx->get('key'),
'source' => $this->get('id'),
//run phpthumbof
$args = array(
'input' => $src,
'options' => $phpThumbOpts
);
$src = $modx->runSnippet('phpThumbOf', $args);
//translate path
$src = preg_replace("/(.*assets\/)/", "", $src);
$src = $modx->config['assets_path'] . $src;
//debug
if ($debug) {
d($options);
d(array($src, $args));
die();
}
//output
$im = imagecreatefromjpeg($src);
header('Content-Type: image/jpeg');
imagejpeg($im);
die();