[Linpha-cvs] SF.net SVN: linpha: [4718] trunk/linpha2
Status: Inactive
Brought to you by:
bzrudi
From: <fan...@us...> - 2007-03-23 16:00:37
|
Revision: 4718 http://svn.sourceforge.net/linpha/?rev=4718&view=rev Author: fangehrn Date: 2007-03-23 09:00:31 -0700 (Fri, 23 Mar 2007) Log Message: ----------- 2007-03-23 flo * fixed bugs in MetaData - 'LIN_OS' -> LIN_OS - exec() -> LinFilesys::linExec() - i18n("test ". "test") -> i18n("test test") - enclose filenames with quotes * and yes, it works under windows! Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/docs/dev/important stuff.txt trunk/linpha2/lib/classes/linpha.exiftool.class.php trunk/linpha2/lib/classes/linpha.metadata.class.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2007-03-23 13:51:32 UTC (rev 4717) +++ trunk/linpha2/ChangeLog 2007-03-23 16:00:31 UTC (rev 4718) @@ -1,3 +1,13 @@ + +2007-03-23 flo + * fixed bugs in MetaData + - 'LIN_OS' -> LIN_OS + - exec() -> LinFilesys::linExec() + - i18n("test ". + "test") -> i18n("test test") + - enclose filenames with quotes + * and yes, it works under windows! + 2007-03-22 bzrudi * Improved MetaData write support and started field type detection Modified: trunk/linpha2/docs/dev/important stuff.txt =================================================================== --- trunk/linpha2/docs/dev/important stuff.txt 2007-03-23 13:51:32 UTC (rev 4717) +++ trunk/linpha2/docs/dev/important stuff.txt 2007-03-23 16:00:31 UTC (rev 4718) @@ -6,7 +6,8 @@ exec($str, $array_output, $return_value); - windows apache may hang if exec() is used twice without session_write_close() before - don't know if this problem is still present + don't know if this problem is still present -> yes it is! (flo, 2007-03-23) + -> do not use exec, but use LinFilesys::linExec which takes care of this - filesize($tmp_file) may return zero if clearstatcache() is not executed! Modified: trunk/linpha2/lib/classes/linpha.exiftool.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.exiftool.class.php 2007-03-23 13:51:32 UTC (rev 4717) +++ trunk/linpha2/lib/classes/linpha.exiftool.class.php 2007-03-23 16:00:31 UTC (rev 4718) @@ -37,15 +37,15 @@ { /** * Automagic set required exiftool depending on OS - * @todo mac/win Testing + * @todo mac detecting and testing */ - if('LIN_OS' != "win") + if(LIN_OS == "unix") { $this->exiftool = LINPHA_DIR.'/lib/classes/exiftool/exiftool'; } - elseif('LIN_OS' == "win") + elseif(LIN_OS == "win") { - $this->exiftool = LINPHA_DIR.'/lib/classes/exiftool/exiftool.exe'; + $this->exiftool = LINPHA_DIR.'\lib\classes\exiftool\exiftool.exe'; // forward slashes will not work } else // Macintosh { @@ -72,7 +72,7 @@ * Buffer output of passthru and save to $thumb var */ ob_start(); - passthru("$this->exiftool $parameters $filename"); + passthru($this->exiftool.' '.$parameters.' "'.$filename.'"'); $thumb = ob_get_contents(); ob_end_clean(); @@ -120,19 +120,21 @@ "-n " . // Read numbers instead of words "-m "; //Ignore minor errors - exec("$this->exiftool $parameters $filename", $meta, $return); - //echo '<pre>', print_r($meta), '</pre>'; + LinFilesys::linExec($this->exiftool.' '.$parameters.' "'.$filename.'"', $meta, $return); + /*echo $this->exiftool.' '.$parameters.' "'.$filename.'"'; + echo '<pre>', print_r($meta), '</pre>'; + exit();*/ + /** * Create usable array information by cycling and splitting * all information */ - foreach($meta AS $value) + foreach($meta as $value) { $temp = explode("\t", $value); $metaArray[trim($temp['0'])] = @trim($temp['1']); } - //echo '<pre>', print_r($test), '</pre>'; return $metaArray; } @@ -205,7 +207,7 @@ "-exif:orientation " . // Get orientation tag "-s -n -t"; // Print tag name tab seper. - exec("$this->exiftool $parameters $filename", $meta, $return); + LinFilesys::linExec($this->exiftool.' '.$parameters.' "'.$filename.'"', $meta, $return); if(is_array($meta)) { Modified: trunk/linpha2/lib/classes/linpha.metadata.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.metadata.class.php 2007-03-23 13:51:32 UTC (rev 4717) +++ trunk/linpha2/lib/classes/linpha.metadata.class.php 2007-03-23 16:00:31 UTC (rev 4718) @@ -544,46 +544,48 @@ $parameter .= "-$metaTag:$name='$value' "; } } - } - //echo '<pre>', print_r($meta_array), '</pre>'; - //echo "PARA :".$parameter; - - /** - * Finally fire up exiftool - * TODO: take care of response status - */ - exec("$exiftool $parameter $file"); - /** - * Copy XMP to IPTC if needed - */ - if($xmp2iptc) - { - $options = "-TagsFromFile "; - $arguments = - LINPHA_DIR.'/lib/classes/exiftool/xmp2iptc.args'; - - exec("$exiftool $options $file -@ $arguments $file"); - } - - /** - * force read data from file again if write was successful - */ - unset ($meta_array); - LinImport:: - updateEntry($GLOBALS['linpha']->template->idCurrent, - dirname($GLOBALS['linpha']->imgview->src_file), - basename($GLOBALS['linpha']->imgview->src_file)); - } - else - { - linSysLog(sprintf(i18n("Error: Processing of: %s failed, " . - "please check write permissions"), - $GLOBALS['linpha']->imgview->src_file)); - linLog(LOG_TYPE_META, LOG_ERR, 'meta_data', "Error: " . - "Processing failed for: ".' ' . - $GLOBALS['linpha']->imgview->src_file); - } + //echo '<pre>', print_r($meta_array), '</pre>'; + //echo "PARA :".$parameter; + + /** + * Finally fire up exiftool + * TODO: take care of response status + */ + $array_output = array(); $return_value = false; + LinFilesys::linExec($exiftool.' '.$parameter.' "'.$file.'"', $array_output, $return_value); + + /** + * Copy XMP to IPTC if needed + */ + if($xmp2iptc) + { + $options = "-TagsFromFile "; + $arguments = + LINPHA_DIR.'/lib/classes/exiftool/xmp2iptc.args'; + + $array_output = array(); $return_value = false; + LinFilesys::linExec($exiftool.' '.$options.' "'.$file.'" -@ '.$arguments.' "'.$file.'"', $array_output, $return_value); + } + + /** + * force read data from file again if write was successful + */ + unset ($meta_array); + LinImport:: + updateEntry($GLOBALS['linpha']->template->idCurrent, + dirname($GLOBALS['linpha']->imgview->src_file), + basename($GLOBALS['linpha']->imgview->src_file)); + } + else + { + linSysLog(sprintf(i18n("Error: Processing of: %s failed, please check write permissions"), + $GLOBALS['linpha']->imgview->src_file)); + linLog(LOG_TYPE_META, LOG_ERR, 'meta_data', "Error: " . + "Processing failed for: ".' ' . + $GLOBALS['linpha']->imgview->src_file); + } + } } } @@ -843,7 +845,7 @@ foreach ($array AS $key => $value) { $value = str_replace("-", "_", strtolower($value)); - $str .= LinSql::linAddslashes(strtolower($value))."VARCHAR(255), "; + $str .= LinSql::linAddslashes(strtolower($value))." VARCHAR(255), "; } $str .= "PRIMARY KEY (md5sum), "; $str .= "KEY (md5sum) )"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |