Better image processing. Add support for GraphicsMagick (a fork of ImageMagick) and exiftool (for stripping EXIF metadata quickly).

This commit is contained in:
Michael Foster 2013-08-03 20:34:59 -04:00
parent a3fbff2259
commit 5300ffadf1
4 changed files with 104 additions and 29 deletions

View file

@ -79,7 +79,7 @@ function loadConfig() {
if ($config['debug']) {
if (!isset($debug)) {
$debug = array('sql' => array(), 'purge' => array(), 'cached' => array(), 'write' => array());
$debug = array('sql' => array(), 'exec' => array(), 'purge' => array(), 'cached' => array(), 'write' => array());
$debug['start'] = microtime(true);
}
}
@ -848,7 +848,7 @@ function bumpThread($id) {
if ($config['try_smarter'])
$build_pages[] = thread_find_page($id);
$query = prepare(sprintf("UPDATE ``posts_%s`` SET `bump` = :time WHERE `id` = :id AND `thread` IS NULL", $board['uri']));
$query->bindValue(':time', time(), PDO::PARAM_INT);
$query->bindValue(':id', $id, PDO::PARAM_INT);
@ -1282,7 +1282,7 @@ function buildIndex() {
for ($page = 1; $page <= $config['max_pages']; $page++) {
$filename = $board['dir'] . ($page == 1 ? $config['file_index'] : sprintf($config['file_page'], $page));
if ($config['try_smarter'] && isset($build_pages) && count($build_pages) && !in_array($page, $build_pages) && is_file($filename))
continue;
$content = index($page);
@ -1928,3 +1928,24 @@ function DNS($host) {
return $ip_addr;
}
function shell_exec_error($command) {
global $config, $debug;
if ($config['debug'])
$start = microtime(true);
$return = trim(shell_exec('PATH="' . escapeshellcmd($config['shell_path']) . ':$PATH";' . $command . ' 2>&1 && echo "TB_SUCCESS"'));
$return = preg_replace('/TB_SUCCESS$/', '', $return);
if ($config['debug']) {
$time = round((microtime(true) - $start) * 1000, 2) . 'ms';
$debug['exec'][] = array(
'command' => $command,
'time' => '~' . $time,
'response' => $return ? $return : null
);
}
return $return === 'TB_SUCCESS' ? false : $return;
}