From: Andreas Unterkircher Date: Sun, 25 May 2008 07:05:49 +0000 (+0200) Subject: fix some notice-warnings caused by some unset variables X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=phpfspot.git;a=commitdiff_plain;h=9609cbda7f2a5ed1bcd0f3a5540b287a3654f4b9;ds=sidebyside fix some notice-warnings caused by some unset variables Signed-off-by: Andreas Unterkircher --- diff --git a/phpfspot.class.php b/phpfspot.class.php index f959eda..3f06a87 100644 --- a/phpfspot.class.php +++ b/phpfspot.class.php @@ -689,7 +689,7 @@ class PHPFSPOT { $info = getimagesize($orig_path); /* get EXIF information if JPEG */ - if($info['mime'] == "image/jpeg") { + if(isset($info['mime']) && $info['mime'] == "image/jpeg") { $meta = $this->get_meta_informations($orig_path); } @@ -748,15 +748,16 @@ class PHPFSPOT { $this->tmpl->assign('current_page', $this->getCurrentPage($current, $count)); $this->tmpl->assign('current_img', $photo); - if($previous_img) { + if(isset($previous_img)) { $this->tmpl->assign('previous_url', "javascript:showPhoto(". $previous_img .");"); $this->tmpl->assign('prev_img', $previous_img); } - if($next_img) { + if(isset($next_img)) { $this->tmpl->assign('next_url', "javascript:showPhoto(". $next_img .");"); $this->tmpl->assign('next_img', $next_img); } + $this->tmpl->assign('mini_width', $this->cfg->mini_width); $this->tmpl->assign('photo_width', $this->cfg->photo_width); $this->tmpl->assign('photo_number', $i); @@ -1575,23 +1576,25 @@ class PHPFSPOT { $flip_hori = false; $flip_vert = false; - switch($meta['Orientation']) { - case 1: /* top, left */ - /* nothing to do */ break; - case 2: /* top, right */ - $rotate = 0; $flip_hori = true; break; - case 3: /* bottom, left */ - $rotate = 180; break; - case 4: /* bottom, right */ - $flip_vert = true; break; - case 5: /* left side, top */ - $rotate = 90; $flip_vert = true; break; - case 6: /* right side, top */ - $rotate = 90; break; - case 7: /* left side, bottom */ - $rotate = 270; $flip_vert = true; break; - case 8: /* right side, bottom */ - $rotate = 270; break; + if(isset($meta['Orientation'])) { + switch($meta['Orientation']) { + case 1: /* top, left */ + /* nothing to do */ break; + case 2: /* top, right */ + $rotate = 0; $flip_hori = true; break; + case 3: /* bottom, left */ + $rotate = 180; break; + case 4: /* bottom, right */ + $flip_vert = true; break; + case 5: /* left side, top */ + $rotate = 90; $flip_vert = true; break; + case 6: /* right side, top */ + $rotate = 90; break; + case 7: /* left side, bottom */ + $rotate = 270; $flip_vert = true; break; + case 8: /* right side, bottom */ + $rotate = 270; break; + } } $src_img = @imagecreatefromjpeg($orig_image); @@ -2291,7 +2294,7 @@ class PHPFSPOT { private function _debug($text) { - if($this->fromcmd) { + if(isset($this->fromcmd)) { print $text; } @@ -2549,7 +2552,7 @@ class PHPFSPOT { $orig_path = $this->translate_path($this->parse_uri($details['uri'], 'fullpath')); /* get EXIF information if JPEG */ - if($details['mime'] == "image/jpeg") { + if(isset($details['mime']) && $details['mime'] == "image/jpeg") { $meta = $this->get_meta_informations($orig_path); }