issue15, check for compatible image type
authorAndreas Unterkircher <unki@netshadow.at>
Sat, 30 Jun 2007 09:34:00 +0000 (09:34 +0000)
committerAndreas Unterkircher <unki@netshadow.at>
Sat, 30 Jun 2007 09:34:00 +0000 (09:34 +0000)
git-svn-id: file:///var/lib/svn/phpfspot/trunk@141 fa6a889d-dae6-447d-9e79-4ba9a3039384

phpfspot.class.php
phpfspot_img.php

index 89cf0b8bfe56b92f6235fcaebe727d9e3b46c5e8..fb54eb6cf87258fa7dd9401308919b8b9976a2e0 100644 (file)
@@ -513,6 +513,12 @@ class PHPFSPOT {
       if(!file_exists($orig_image))
          return false;
 
       if(!file_exists($orig_image))
          return false;
 
+      $details = getimagesize($orig_image);
+      
+      /* check if original photo is a support image type */
+      if(!$this->parent->checkifImageSupported($details['mime']))
+         return false;
+
       $meta = $this->get_meta_informations($orig_image);
 
       $rotate = 0;
       $meta = $this->get_meta_informations($orig_image);
 
       $rotate = 0;
@@ -877,6 +883,15 @@ class PHPFSPOT {
 
    } // _debug()
 
 
    } // _debug()
 
+   public function checkifImageSupported($mime)
+   {
+      if(in_array($mime, Array("image/jpeg")))
+         return true;
+
+      return false;
+
+   } // checkifImageSupported()
+
 }
 
 ?>
 }
 
 ?>
index 69f579bf20c04f32b16dc48228cf90ba3e8ce1d0..c21ff593c3e2be2e74f03f3cffc950f8d1b79486 100644 (file)
@@ -51,6 +51,11 @@ class PHPFSPOT_IMG {
       $tmp = getimagesize($fullpath);
       $mime = $tmp['mime'];
 
       $tmp = getimagesize($fullpath);
       $mime = $tmp['mime'];
 
+      if(!$this->parent->checkifImageSupported($mime)) {
+         $this->parent->showTextImage("Unsupported Image Type");
+         return;
+      }
+
       Header("Content-Type: ". $mime);
       Header("Content-Length: ". filesize($fullpath));
       Header("Content-Transfer-Encoding: binary\n");              
       Header("Content-Type: ". $mime);
       Header("Content-Length: ". filesize($fullpath));
       Header("Content-Transfer-Encoding: binary\n");