$scriptProperties['debug'] = isset($debug) ? $debug : false;
static $pt_settings = array();
if (empty($pt_settings)) {
    if (!$modx->loadClass('phpThumbOf', MODX_CORE_PATH . 'components/phpthumbof/model/', true, true)) {
        $modx->log(modX::LOG_LEVEL_ERROR, '[pThumb] Could not load phpThumbOf class.');
        return $input;
    }
}
$pThumb = new phpThumbOf($modx, $pt_settings, $scriptProperties);
$result = $pThumb->createThumbnail($input, $options);
if (!empty($toPlaceholder) || $result['outputDims']) {
    if ($result['width'] === '' && $result['file'] && ($dims = getimagesize($result['file']))) {
        $result['width'] = $dims[0];
        $result['height'] = $dims[1];
    }
    if (!empty($toPlaceholder)) {
        $modx->setPlaceholders(array($toPlaceholder => $result['src'], "{$toPlaceholder}.width" => $result['width'], "{$toPlaceholder}.height" => $result['height']));
        $output = '';
    }
    if ($result['outputDims']) {
        $output = "src=\"{$result['src']}\"" . ($result['width'] ? " width=\"{$result['width']}\" height=\"{$result['height']}\"" : '');
    }
} else {
    $output = $result['src'];
}
if ($debug && $result['success']) {
    // if debugging is on and createThumbnail was successful, log the debug info
    $pThumb->debugmsg(isset($pThumb->phpThumb->debugmessages) ? ':: Processed ::' : ":: Loaded from cache: {$result['src']}", true);
}
return $output;
return;