mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-02-11 09:35:00 +00:00
return empty text if image has no iptc data
This commit is contained in:
parent
735fe4235f
commit
292ade83e7
|
@ -51,25 +51,24 @@ class SeedDMS_ConversionServiceImageToText extends SeedDMS_ConversionServiceBase
|
|||
public function convert($infile, $target = null, $params = array()) { /* {{{ */
|
||||
$start = microtime(true);
|
||||
$imsize = getimagesize($infile, $moreinfo);
|
||||
$txt = '';
|
||||
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;
|
||||
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;
|
||||
}
|
||||
} /* }}} */
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user