summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpfspot.class.php4
-rw-r--r--phpfspot_img.php7
2 files changed, 9 insertions, 2 deletions
diff --git a/phpfspot.class.php b/phpfspot.class.php
index 2ffec5f..9c426a3 100644
--- a/phpfspot.class.php
+++ b/phpfspot.class.php
@@ -536,7 +536,7 @@ class PHPFSPOT {
} // check_config_table
- public function gen_thumb($idx = 0, $fromcmd = 0)
+ public function gen_thumb($idx = 0, $fromcmd = 0, $force = 0)
{
$details = $this->get_photo_details($idx);
@@ -546,7 +546,7 @@ class PHPFSPOT {
if($fromcmd) print "Image [". $idx ."] ". $details['name'] ." Thumbnails:";
/* if the file hasn't changed there is no need to regen the thumb */
- if($file_md5 == $this->getMD5($idx)) {
+ if(!$force && $file_md5 == $this->getMD5($idx)) {
if($fromcmd) print " file has not changed - skipping\n";
return;
}
diff --git a/phpfspot_img.php b/phpfspot_img.php
index 60c06b0..e3b0852 100644
--- a/phpfspot_img.php
+++ b/phpfspot_img.php
@@ -32,6 +32,13 @@ class PHPFSPOT_IMG {
$fullpath = $this->parent->translate_path($details['directory_path']) ."/thumbs/". $width ."_". $details['name'];
}
+ if(!file_exists($fullpath)) {
+ $this->parent->gen_thumb($idx, 0, 1);
+ }
+ if(!is_readable($fullpath)) {
+ die("File ". $fullpath ." is not readable. Check the permissions");
+ }
+
$tmp = getimagesize($fullpath);
$mime = $tmp['mime'];