// Resize image: $im2 = imagecreatetruecolor($nw, $nh); imagecopyresampled($im2, $im, 0, 0, 0, $ystart, $nw, $nh, $w, $yheight); imageinterlace($im2, true); // For progressive JPEG. $tempname = $filepath . '_TEMP.jpg'; imagejpeg($im2, $tempname, 90); imagedestroy($im); imagedestroy($im2); unlink($filepath); rename($tempname, $filepath); // Overwrite original picture with thumbnail. return true; } try { mergeDeprecatedConfig($GLOBALS, isLoggedIn()); } catch (Exception $e) { error_log('ERROR while merging deprecated options.php file.' . PHP_EOL . $e->getMessage()); } if (isset($_SERVER["QUERY_STRING"]) && startswith($_SERVER["QUERY_STRING"], 'do=genthumbnail')) { genThumbnail(); exit; } // Thumbnail generation/cache does not need the link database. if (isset($_SERVER["QUERY_STRING"]) && startswith($_SERVER["QUERY_STRING"], 'do=rss')) { showRSS(); exit; } if (isset($_SERVER["QUERY_STRING"]) && startswith($_SERVER["QUERY_STRING"], 'do=atom')) { showATOM(); exit;
/** * Test mergeDeprecatedConfig while being logged in without options file. */ public function testMergeDeprecatedConfigNoFile() { writeConfig(self::$_configFields, true); mergeDeprecatedConfig(self::$_configFields, true); include self::$_configFields['config']['CONFIG_FILE']; $this->assertEquals(self::$_configFields['login'], $GLOBALS['login']); }