+ }
+ /* show thumbnail */
+ else {
+ /* if no entry for this photo is yet in the database, create thumb */
+ if(!$this->parent->getMD5($idx)) {
+ $this->parent->gen_thumb($idx);
+ }
+ $fullpath = $this->parent->cfg->base_path ."/thumbs/". $width ."_". $this->parent->getMD5($idx);
+ /* if the thumb file does not exist, create it */
+ if(!file_exists($fullpath)) {
+ $this->parent->gen_thumb($idx);
+ }
+ }
+
+ if(!file_exists($fullpath)) {
+ $this->parent->showTextImage("File ". basename($fullpath) ." does not exist");
+ return;
+ }
+ if(!is_readable($fullpath)) {
+ $this->parent->showTextImage("File ". basename($fullpath) ." is not readable. Check the permissions");
+ return;
+ }