$k = 0.3; $round = 10; if (isset($_GET['h'])) { $opt['height'] = floor((int) $_GET['h'] * $k / $round) * $round; } else { $opt['height'] = 200; } } elseif ($_GET['type'] == 'startpage' && isset($_GET['w']) && isset($_GET['h'])) { $k = 0.4; $w = (int) $_GET['w']; $h = (int) $_GET['h']; $round = 10; $opt['height'] = floor($h * $k / $round) * $round; $opt['width'] = $opt['height'] * 2; } $rootPath = dirname(dirname(dirname(__FILE__))) . '/'; } else { $opt = array(); $rootPath = dirname(__FILE__) . '/'; } $path = realpath(dirname(__FILE__) . '/../../system/Library/'); require $path . '/PhpResizer/Autoloader.php'; new PhpResizer_Autoloader(); try { $resizer = new PhpResizer_PhpResizer(array('cacheDir' => realpath(dirname(__FILE__) . '/../../tmp/PhpResizer/'), 'tmpDir' => realpath(dirname(__FILE__) . '/../../tmp/tmp/'), 'cache' => true, 'cacheBrowser' => true, 'engine' => PhpResizer_PhpResizer::ENGINE_GD2)); $resizer->resize($rootPath . $file, $opt); } catch (Exception $e) { echo $e->getMessage(); echo $e->getFile(); echo $e->getLine(); }