$img = new Imagick($path);
$img->cropThumbnailImage(1080, 600);
$img->setImageCompressionQuality(80);
$img->writeImage($_SERVER['DOCUMENT_ROOT'] . '/public/materials/'.$id.'.jpg');
public function add($route, $params) {
$route = preg_replace('/{([a-z]+):([^\}]+)}/', '(?<\1>\2)', $route);
$route = '#^'.$route.'$#';
// echo $route . '<br>';
$this->routes[$route] = $params;
}
public function match() {
$url = trim($_SERVER['REQUEST_URI'], '/');
foreach ($this->routes as $route => $params) {
// echo($route . '<br>');
if (preg_match($route, $url, $matches)) {
// debug($matches);
foreach ($matches as $key => $match) {
if (is_string($key)) {
if (is_numeric($match)) {
$match = (int) $match;
}
$params[$key] = $match;
}
}
$this->params = $params;
return true;
}
}
return false;
}
Сейчас он такой6