make extra-sure that only valud file types are handled (.bmp renamed to .jpg used to sneak though)

git-svn-id: file:///home/shish/svn/shimmie2/trunk@732 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
shish 2008-03-29 03:59:34 +00:00
parent 77e818c4aa
commit 0356a84a6e

View File

@ -72,7 +72,12 @@ class PixelFileHandler extends Extension {
}
private function check_contents($file) {
return (file_exists($file) && !is_null(getimagesize($file)));
$valid = Array(IMAGETYPE_PNG, IMAGETYPE_GIF, IMAGETYPE_JPEG);
if(!file_exists($file)) return false;
$info = getimagesize($file);
if(is_null($info)) return false;
if(array_contains($valid, $info[2])) return true;
return false;
}
private function create_thumb($hash) {