$folder = $cfg['media']; $path = $folder . $file; $path = $f3->fixslashes($path); $path = str_replace("//", "/", $path); //test_string($path); $mime = mime_content_type($path); if ($mime == "application/pdf") { $thumb = DIRECTORY_SEPARATOR . str_replace(".pdf", "_thumb.png", $file); //test_array($thumb); if (!file_exists($folder . $thumb) && file_exists($folder . $file)) { $exportPath = $folder . $thumb; $res = "96"; $pdf = $folder . $file; $str = "gs -dCOLORSCREEN -dNOPAUSE -box -sDEVICE=png16m -dUseCIEColor -dTextAlphaBits=4 -dFirstPage=1 -dLastPage=1 -dGraphicsAlphaBits=4 -o{$exportPath} -r{$res} {$pdf}"; exec($str); \general::remove_white($folder . $thumb); } $file = DIRECTORY_SEPARATOR . str_replace(".pdf", ".png", $file); } //test_array($file); if ($file) { $gen = new \general(); $gen->thumbnail($file, $width, $height, $crop, $enlarge); } }); $f3->route('GET|POST /logout', function ($f3, $params) use($user) { session_start(); session_unset(); session_destroy(); session_write_close(); setcookie(session_name(), '', 0, '/');