summaryrefslogtreecommitdiffstats
path: root/phpfspot.class.php
diff options
context:
space:
mode:
authorAndreas Unterkircher <unki@netshadow.at>2008-01-01 18:43:27 +0100
committerAndreas Unterkircher <unki@netshadow.at>2008-01-01 20:13:15 +0100
commitaed571db7a6edcc6078a2d77ef1f60928bab79ca (patch)
tree902fb1e39e614eb54045c8a578f083773e2a6811 /phpfspot.class.php
parente54956dad7e0632849db2a92eb7ceff88b52247d (diff)
issue88, overwrite option for gen_thumbs.php
Diffstat (limited to 'phpfspot.class.php')
-rw-r--r--phpfspot.class.php20
1 files changed, 13 insertions, 7 deletions
diff --git a/phpfspot.class.php b/phpfspot.class.php
index 63a9139..9e78d1d 100644
--- a/phpfspot.class.php
+++ b/phpfspot.class.php
@@ -1306,7 +1306,7 @@ class PHPFSPOT {
* 2. Check if the md5sum of the original file has changed
* 3. Generate the thumbnails if needed
*/
- public function gen_thumb($idx = 0, $force = 0)
+ public function gen_thumb($idx = 0, $force = 0, $overwrite = false)
{
$error = 0;
@@ -1339,6 +1339,8 @@ class PHPFSPOT {
$changes = false;
foreach($resolutions as $resolution) {
+
+ $generate_it = false;
$thumb_sub_path = substr($file_md5, 0, 2);
$thumb_path = $this->cfg->thumb_path ."/". $thumb_sub_path ."/". $resolution ."_". $file_md5;
@@ -1349,15 +1351,14 @@ class PHPFSPOT {
/* if the thumbnail file doesn't exist, create it */
if(!file_exists($thumb_path)) {
-
- $this->_debug(" ". $resolution ."px");
- if(!$this->create_thumbnail($full_path, $thumb_path, $resolution))
- $error = 1;
-
- $changes = true;
+ $generate_it = true;
}
/* if the file hasn't changed there is no need to regen the thumb */
elseif($file_md5 != $this->getMD5($idx) || $force) {
+ $generate_it = true;
+ }
+
+ if($generate_it || $overwrite) {
$this->_debug(" ". $resolution ."px");
if(!$this->create_thumbnail($full_path, $thumb_path, $resolution))
@@ -1632,6 +1633,11 @@ class PHPFSPOT {
print "PEAR Calendar package is missing<br />\n";
$missing = true;
}
+ @include_once 'Console/Getopt.php';
+ if(isset($php_errormsg) && preg_match('/Failed opening.*for inclusion/i', $php_errormsg)) {
+ print "PEAR Console_Getopt package is missing<br />\n";
+ $missing = true;
+ }
ini_restore('track_errors');
if(isset($missing))