mirror of
https://git.code.sf.net/p/seeddms/code
synced 2024-11-26 07:22:11 +00:00
fix preview for files in dropfolder
This commit is contained in:
parent
eb51882726
commit
53d7ab063d
|
@ -4,6 +4,7 @@
|
|||
- rest api returns error msg and not just http status
|
||||
- comment of document, documentcontent and folder can be rendered as
|
||||
markdown
|
||||
- fix preview for file in drop folder
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
Changes in version 5.1.30
|
||||
|
|
|
@ -34,27 +34,24 @@ if (!isset($_GET["filename"])) {
|
|||
}
|
||||
$filename = $_GET["filename"];
|
||||
|
||||
if(substr($settings->_dropFolderDir, -1, 1) == DIRECTORY_SEPARATOR)
|
||||
$dropfolderdir = substr($settings->_dropFolderDir, 0, -1);
|
||||
else
|
||||
$dropfolderdir = $settings->_dropFolderDir;
|
||||
$dir = $dropfolderdir.'/'.$user->getLogin();
|
||||
$dir = rtrim($settings->_dropFolderDir, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.$user->getLogin();
|
||||
|
||||
if(!file_exists($dir.'/'.$filename))
|
||||
if(!file_exists($dir.DIRECTORY_SEPARATOR.$filename))
|
||||
exit;
|
||||
|
||||
$finfo = finfo_open(FILEINFO_MIME_TYPE);
|
||||
$mimetype = finfo_file($finfo, $dir.'/'.$filename);
|
||||
|
||||
if(!empty($_GET["width"]))
|
||||
$previewer = new SeedDMS_Preview_Previewer($settings->_cacheDir, $_GET["width"]);
|
||||
$previewer = new SeedDMS_Preview_Previewer($settings->_cacheDir, $_GET["width"], $settings->_cmdTimeout, $settings->_enableXsendfile);
|
||||
else
|
||||
$previewer = new SeedDMS_Preview_Previewer($settings->_cacheDir);
|
||||
$previewer->setConverters($settings->_converters['preview']);
|
||||
$previewer->setXsendfile($settings->_enableXsendfile);
|
||||
$previewer = new SeedDMS_Preview_Previewer($settings->_cacheDir, $settings->_previewWidthList, $settings->_cmdTimeout, $settings->_enableXsendfile);
|
||||
if($conversionmgr)
|
||||
$previewer->setConversionMgr($conversionmgr);
|
||||
else
|
||||
$previewer->setConverters($previewconverters);
|
||||
if(!$previewer->hasRawPreview($dir.'/'.$filename, 'dropfolder/'))
|
||||
$previewer->createRawPreview($dir.'/'.$filename, 'dropfolder/', $mimetype);
|
||||
header('Content-Type: image/png');
|
||||
$previewer->getRawPreview($dir.'/'.$filename, 'dropfolder/');
|
||||
|
||||
?>
|
||||
|
|
|
@ -57,9 +57,11 @@ if($view) {
|
|||
$view->setParam('dropfolderdir', $dropfolderdir);
|
||||
$view->setParam('dropfolderfile', isset($_GET["dropfolderfile"]) ? $_GET["dropfolderfile"] : '');
|
||||
$view->setParam('form', $form);
|
||||
$view->setParam('conversionmgr', $conversionmgr);
|
||||
$view->setParam('cachedir', $settings->_cacheDir);
|
||||
$view->setParam('previewWidthMenuList', $settings->_previewWidthMenuList);
|
||||
$view->setParam('previewWidthList', $settings->_previewWidthDropFolderList);
|
||||
$view->setParam('previewConverters', isset($settings->_converters['preview']) ? $settings->_converters['preview'] : array());
|
||||
$view->setParam('timeout', $settings->_cmdTimeout);
|
||||
$view->setParam('xsendfile', $settings->_enableXsendfile);
|
||||
$view->setParam('showfolders', $showfolders);
|
||||
|
|
|
@ -54,16 +54,22 @@ $('.folderselect').click(function(ev) {
|
|||
$dropfolderdir = $this->params['dropfolderdir'];
|
||||
$showfolders = $this->params['showfolders'];
|
||||
$cachedir = $this->params['cachedir'];
|
||||
$conversionmgr = $this->params['conversionmgr'];
|
||||
$previewwidth = $this->params['previewWidthMenuList'];
|
||||
$previewconverters = $this->params['previewConverters'];
|
||||
$timeout = $this->params['timeout'];
|
||||
$xsendfile = $this->params['xsendfile'];
|
||||
$folder = $this->params['folder'];
|
||||
|
||||
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth, $timeout, $xsendfile);
|
||||
if($conversionmgr)
|
||||
$previewer->setConversionMgr($conversionmgr);
|
||||
else
|
||||
$previewer->setConverters($previewconverters);
|
||||
|
||||
$c = 0; // count files
|
||||
$menuitems['dropfolder'] = array('label'=>'', 'children'=>array());
|
||||
$dir = rtrim($dropfolderdir, '/').'/'.$user->getLogin();
|
||||
$dir = rtrim($dropfolderdir, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.$user->getLogin();
|
||||
/* Check if we are still looking in the configured directory and
|
||||
* not somewhere else, e.g. if the login was '../test'
|
||||
*/
|
||||
|
@ -74,15 +80,15 @@ $('.folderselect').click(function(ev) {
|
|||
$finfo = finfo_open(FILEINFO_MIME_TYPE);
|
||||
while (false !== ($entry = $d->read())) {
|
||||
if($entry != '..' && $entry != '.') {
|
||||
if($showfolders == 0 && !is_dir($dir.'/'.$entry) && is_readable($dir.'/'.$entry)) {
|
||||
if($showfolders == 0 && !is_dir($dir.DIRECTORY_SEPARATOR.$entry) && is_readable($dir.DIRECTORY_SEPARATOR.$entry)) {
|
||||
$c++;
|
||||
$subitem = array('label'=>'', 'attributes'=>array(array('title', getMLText('menu_upload_from_dropfolder'))));
|
||||
if($folder)
|
||||
$subitem['link'] = $settings->_httpRoot.'out/out.AddDocument.php?folderid='.$folder->getId()."&dropfolderfileform1=".urldecode($entry);
|
||||
$mimetype = finfo_file($finfo, $dir.'/'.$entry);
|
||||
$mimetype = finfo_file($finfo, $dir.DIRECTORY_SEPARATOR.$entry);
|
||||
if($previewwidth) {
|
||||
$previewer->createRawPreview($dir.'/'.$entry, 'dropfolder/', $mimetype);
|
||||
if($previewer->hasRawPreview($dir.'/'.$entry, 'dropfolder/')) {
|
||||
$previewer->createRawPreview($dir.DIRECTORY_SEPARATOR.$entry, 'dropfolder'.DIRECTORY_SEPARATOR, $mimetype);
|
||||
if($previewer->hasRawPreview($dir.DIRECTORY_SEPARATOR.$entry, 'dropfolder'.DIRECTORY_SEPARATOR)) {
|
||||
$subitem['label'] .= "<div class=\"dropfolder-menu-img\" style=\"display: none; overflow:hidden; position: absolute; left:-".($previewwidth+10)."px; border: 1px solid #888;background: white;\"><img filename=\"".$entry."\" width=\"".$previewwidth."\" src=\"".$settings->_httpRoot."op/op.DropFolderPreview.php?filename=".$entry."&width=".$previewwidth."\" title=\"".htmlspecialchars($mimetype)."\"></div>";
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user