echo file_get_contents(generateImage($pngFilePath, $jpgCachePath, $resolution, 'png', 'jpg')); } else { header('Content-Type: image/png'); echo file_get_contents($pngFilePath); } } } else { if (strlen($messages) == 0 || $messages == "[OK]") { $messages = "[Incorrect file specified, please check your path]"; } } } if ($format == "jpg") { if (validSwfParams($swfFilePath, $swfdoc, $page)) { if (!file_exists($pngFilePath)) { $pngconv = new swfrender(); $pngconv->renderPage($pdfdoc, $swfdoc, $page, $subfolder); } if ($configManager->getConfig('allowcache')) { setCacheHeaders(); } if (!$configManager->getConfig('allowcache') || $configManager->getConfig('allowcache') && endOrRespond()) { header('Content-Type: image/jpeg'); if (file_exists($jpgCachePath)) { echo file_get_contents($jpgCachePath); } else { if ($resolution == null) { echo file_get_contents(generateImage($pngFilePath, $jpgCachePath, 1200, 'png', 'jpg')); } else { echo file_get_contents(generateImage($pngFilePath, $jpgCachePath, $resolution, 'png', 'jpg')); }
echo "Error:Cannot read directories set up in configuration file, please check your configuration."; } else { if (!validPdfParams($pdfFilePath, $pdfdoc, $page)) { echo "Error:Incorrect file specified, please check your path"; } else { if ($format == "swf" || $format == "png" || $format == "pdf") { // converting pdf files to swf format if (!file_exists($swfFilePath)) { $pdfconv = new pdf2swf(); $messages = $pdfconv->convert($pdfdoc, $page); } // rendering swf files to png images if ($format == "png") { if (validSwfParams($swfFilePath, $swfdoc, $page)) { if (!file_exists($pngFilePath)) { $pngconv = new swfrender(); $pngconv->renderPage($pdfdoc, $swfdoc, $page); } if ($configManager->getConfig('allowcache')) { setCacheHeaders(); } if (!$configManager->getConfig('allowcache') || $configManager->getConfig('allowcache') && endOrRespond()) { if ($resolution != null) { header('Content-Type: image/jpeg'); echo file_get_contents(generateImage($pngFilePath, $jpgCachePath, $resolution, 'jpg')); } else { header('Content-Type: image/png'); echo file_get_contents($pngFilePath); } } } else {