mirror of
https://git.code.sf.net/p/seeddms/code
synced 2024-11-26 15:32:13 +00:00
Merge branch 'seeddms-5.1.x' into seeddms-6.0.x
This commit is contained in:
commit
a453c0e6ef
5
TODO
5
TODO
|
@ -1,3 +1,6 @@
|
|||
This list is hopelessly outdated, but some of the issues are
|
||||
still worth to be implemented!
|
||||
|
||||
Update comment and date of a review/approval, if the same status is set
|
||||
again. Currently setting the same status is turned of, because it didn't
|
||||
have any effect, which is quite confusing if the user can do an operation
|
||||
|
@ -25,8 +28,6 @@ approaches to get the configuration directory.
|
|||
|
||||
Show expiration status of documents in document list
|
||||
|
||||
Copy folders recursivly
|
||||
|
||||
Allow operations like delete, move, approve, etc. on a list of documents
|
||||
|
||||
installation script:
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
require_once("inc/inc.ClassConversionServiceExec.php");
|
||||
require_once("inc/inc.ClassConversionServiceImageToImage.php");
|
||||
require_once("inc/inc.ClassConversionServiceImageToText.php");
|
||||
require_once("inc/inc.ClassConversionServicePdfToImage.php");
|
||||
require_once("inc/inc.ClassConversionServiceTextToText.php");
|
||||
|
||||
|
|
75
inc/inc.ClassConversionServiceImageToText.php
Normal file
75
inc/inc.ClassConversionServiceImageToText.php
Normal file
|
@ -0,0 +1,75 @@
|
|||
<?php
|
||||
/**
|
||||
* Implementation of conversion service image class
|
||||
*
|
||||
* @category DMS
|
||||
* @package SeedDMS
|
||||
* @license GPL 2
|
||||
* @version @version@
|
||||
* @author Uwe Steinmann <uwe@steinmann.cx>
|
||||
* @copyright Copyright (C) 2021 Uwe Steinmann
|
||||
* @version Release: @package_version@
|
||||
*/
|
||||
|
||||
require_once("inc/inc.ClassConversionServiceBase.php");
|
||||
|
||||
/**
|
||||
* Implementation of conversion service image class
|
||||
*
|
||||
* @category DMS
|
||||
* @package SeedDMS
|
||||
* @author Uwe Steinmann <uwe@steinmann.cx>
|
||||
* @copyright Copyright (C) 2021 Uwe Steinmann
|
||||
* @version Release: @package_version@
|
||||
*/
|
||||
class SeedDMS_ConversionServiceImageToText extends SeedDMS_ConversionServiceBase {
|
||||
/**
|
||||
* timeout
|
||||
*/
|
||||
public $timeout;
|
||||
|
||||
public function __construct($from, $to) { /* {{{ */
|
||||
$this->from = $from;
|
||||
$this->to = $to;
|
||||
} /* }}} */
|
||||
|
||||
public function getInfo() { /* {{{ */
|
||||
return "Convert by extracting iptc data";
|
||||
} /* }}} */
|
||||
|
||||
public function getAdditionalParams() { /* {{{ */
|
||||
return [
|
||||
];
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Convert a pixel image into text by reading the iptc data
|
||||
*
|
||||
* This method uses getimagesize() to extract the data.
|
||||
*/
|
||||
public function convert($infile, $target = null, $params = array()) { /* {{{ */
|
||||
$start = microtime(true);
|
||||
$imsize = getimagesize($infile, $moreinfo);
|
||||
if(!empty($moreinfo['APP13'])) {
|
||||
$txt = '';
|
||||
$iptcdata = iptcparse($moreinfo['APP13']);
|
||||
foreach(['2#005', '2#015', '2#025', '2#105', '2#080', '2#115', '2#120'] as $key) {
|
||||
if(isset($iptcdata[$key]))
|
||||
$txt .= implode(' ', $iptcdata[$key])."\n";
|
||||
}
|
||||
$end = microtime(true);
|
||||
if($this->logger) {
|
||||
$this->logger->log('Conversion from '.$this->from.' to '.$this->to.' by extracting iptc took '.($end-$start).' sec.', PEAR_LOG_INFO);
|
||||
}
|
||||
if($target) {
|
||||
file_put_contents($target, $txt);
|
||||
return true;
|
||||
} else {
|
||||
return $txt;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
} /* }}} */
|
||||
}
|
||||
|
||||
|
|
@ -34,6 +34,9 @@ if(extension_loaded('gd') || extension_loaded('imagick')) {
|
|||
$conversionmgr->addService(new SeedDMS_ConversionServiceImageToImage('image/gif', 'image/png'))->setLogger($logger);
|
||||
}
|
||||
|
||||
$conversionmgr->addService(new SeedDMS_ConversionServiceImageToText('image/jpeg', 'text/plain'))->setLogger($logger);
|
||||
$conversionmgr->addService(new SeedDMS_ConversionServiceImageToText('image/jpg', 'text/plain'))->setLogger($logger);
|
||||
|
||||
$conversionmgr->addService(new SeedDMS_ConversionServiceTextToText('text/plain', 'text/plain'))->setLogger($logger);
|
||||
|
||||
if(isset($GLOBALS['SEEDDMS_HOOKS']['initConversion'])) {
|
||||
|
|
|
@ -195,6 +195,38 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Theme_Style {
|
|||
echo json_encode($jsondata);
|
||||
} /* }}} */
|
||||
|
||||
protected function iptcdata($arr) { /* {{{ */
|
||||
$iptcHeaderArray = array (
|
||||
'2#005'=>'DocumentTitle',
|
||||
'2#010'=>'Urgency',
|
||||
'2#015'=>'Category',
|
||||
'2#025'=>'Keywords',
|
||||
'2#020'=>'Subcategories',
|
||||
'2#040'=>'SpecialInstructions',
|
||||
'2#055'=>'CreationDate',
|
||||
'2#080'=>'AuthorByline',
|
||||
'2#085'=>'AuthorTitle',
|
||||
'2#090'=>'City',
|
||||
'2#095'=>'State',
|
||||
'2#101'=>'Country',
|
||||
'2#103'=>'OTR',
|
||||
'2#105'=>'Headline',
|
||||
'2#110'=>'Source',
|
||||
'2#115'=>'PhotoSource',
|
||||
'2#116'=>'Copyright',
|
||||
'2#120'=>'Caption',
|
||||
'2#122'=>'CaptionWriter'
|
||||
);
|
||||
$retStr = '<table class="table">';
|
||||
if(is_array($arr)) {
|
||||
foreach ($arr as $key=>$val) {
|
||||
$retStr .= '<tr><td>' . $iptcHeaderArray[$key] . '</td><td>' . htmlspecialchars(implode('; ', $val)) . '</td></tr>';
|
||||
}
|
||||
}
|
||||
$retStr .= '</table>';
|
||||
return $retStr;
|
||||
} /* }}} */
|
||||
|
||||
function js() { /* {{{ */
|
||||
$dms = $this->params['dms'];
|
||||
$user = $this->params['user'];
|
||||
|
@ -366,7 +398,7 @@ $(document).ready( function() {
|
|||
if(is_string($txt))
|
||||
echo $txt;
|
||||
else {
|
||||
$this->contentHeading(getMLText("document_infos"));
|
||||
$this->contentHeading(htmlspecialchars($document->getName()));
|
||||
$txt = $this->callHook('checkOutInfo', $document);
|
||||
if(is_string($txt)) {
|
||||
echo $txt;
|
||||
|
@ -698,9 +730,9 @@ $(document).ready( function() {
|
|||
// print "</tr></thead><tbody>\n";
|
||||
// print "<tr>\n";
|
||||
// print "<td style=\"width:".$previewwidthdetail."px; text-align: center;\">";
|
||||
$this->contentHeading(htmlspecialchars($latestContent->getOriginalFileName()));
|
||||
// $this->contentHeading(htmlspecialchars($latestContent->getOriginalFileName()));
|
||||
$this->rowStart();
|
||||
$this->columnStart(4);
|
||||
$this->columnStart(3);
|
||||
if ($file_exists) {
|
||||
if ($viewonlinefiletypes && (in_array(strtolower($latestContent->getFileType()), $viewonlinefiletypes) || in_array(strtolower($latestContent->getMimeType()), $viewonlinefiletypes))) {
|
||||
if($accessobject->check_controller_access('ViewOnline', array('action'=>'run')))
|
||||
|
@ -723,13 +755,24 @@ $(document).ready( function() {
|
|||
|
||||
// print "<td>";
|
||||
$this->columnEnd();
|
||||
$this->columnStart(4);
|
||||
$this->columnStart(5);
|
||||
print "<ul class=\"actions unstyled\">\n";
|
||||
print "<li>".htmlspecialchars($latestContent->getOriginalFileName())."</li>\n";
|
||||
print "<li>".getMLText('version').": ".$latestContent->getVersion()."</li>\n";
|
||||
|
||||
if ($file_exists)
|
||||
print "<li>". SeedDMS_Core_File::format_filesize($latestContent->getFileSize()) .", ".htmlspecialchars($latestContent->getMimeType())."</li>";
|
||||
else print "<li><span class=\"warning\">".getMLText("document_deleted")."</span></li>";
|
||||
if ($file_exists) {
|
||||
print "<li>". SeedDMS_Core_File::format_filesize($latestContent->getFileSize()) .", ";
|
||||
print htmlspecialchars($latestContent->getMimeType());
|
||||
if(in_array($latestContent->getMimeType(), ['image/jpeg', 'image/jpg', 'image/png', 'image/bmp'])) {
|
||||
$imsize = getimagesize($dms->contentDir . $latestContent->getPath(), $moreinfo);
|
||||
if(!empty($moreinfo['APP13'])) {
|
||||
echo ', '.$this->printPopupBox(getMLText('iptc_metadata'), $this->iptcdata(iptcparse($moreinfo['APP13'])), true);
|
||||
}
|
||||
if($imsize[0] && $imsize[1])
|
||||
print ', '.$imsize[0].'×'.$imsize[1].' px';
|
||||
}
|
||||
print "</li>";
|
||||
} else print "<li><span class=\"warning\">".getMLText("document_deleted")."</span></li>";
|
||||
|
||||
$updatingUser = $latestContent->getUser();
|
||||
print "<li>".getMLText("uploaded_by")." <a href=\"mailto:".htmlspecialchars($updatingUser->getEmail())."\">".htmlspecialchars($updatingUser->getFullName())."</a></li>";
|
||||
|
|
|
@ -375,7 +375,6 @@ div.popupbox {
|
|||
display: none;
|
||||
position: absolute;
|
||||
min-width: 230px;
|
||||
max-width: 280px;
|
||||
white-space: break-spaces;
|
||||
z-index: 10;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user