checks for files without extensions, from AtomicDryad

This commit is contained in:
Shish
2010-12-22 21:43:00 +00:00
parent 6ddd0b3e6f
commit ead87d3934
2 changed files with 31 additions and 1 deletions

View File

@ -32,6 +32,17 @@ class PixelFileHandler extends DataHandlerExtension {
return $image;
}
protected function find_ext($file) {
$phpimgexts = array ( 1=> 'gif', 'jpg', 'png', 'swf', 'psd', 'bmp', 'tiff', 'tiff',
'jpc', 'jp2', 'jpf', 'jb2', 'swc', 'aiff', 'wbmp', 'xbm'); // const, do not change. Less overhead / PITA than image_type_to_extension($info[2])
if(!file_exists($file)) return false;
$info = getimagesize($file);
$exts = array("jpg", "jpeg", "gif", "png");
$ret=$phpimgexts[$info[2]];
return (in_array($ret,$exts)?$ret:false);
}
protected function check_contents($file) {
$valid = Array(IMAGETYPE_PNG, IMAGETYPE_GIF, IMAGETYPE_JPEG);
if(!file_exists($file)) return false;