A bunch of small changes from scrutinizer-ci; some tidying, some actual bug fixes

This commit is contained in:
Shish
2014-03-30 13:26:48 +01:00
parent db5aa56300
commit c8aa3327a1
31 changed files with 170 additions and 266 deletions

View File

@ -14,8 +14,6 @@ class PixelFileHandler extends DataHandlerExtension {
}
protected function create_image_from_data(/*string*/ $filename, /*array*/ $metadata) {
global $config;
$image = new Image();
$info = getimagesize($filename);
@ -52,9 +50,10 @@ class PixelFileHandler extends DataHandlerExtension {
}
protected function create_thumb_force(/*string*/ $hash) {
global $config;
$inname = warehouse_path("images", $hash);
$outname = warehouse_path("thumbs", $hash);
global $config;
$ok = false;
@ -165,7 +164,7 @@ class PixelFileHandler extends DataHandlerExtension {
if($width > $height*5) $width = $height*5;
if($height > $width*5) $height = $width*5;
$image = imagecreatefromstring($this->read_file($tmpname));
$image = imagecreatefromstring(file_get_contents($tmpname));
$tsize = get_thumbnail_size($width, $height);
$thumb = imagecreatetruecolor($tsize[0], $tsize[1]);
@ -176,16 +175,6 @@ class PixelFileHandler extends DataHandlerExtension {
return $thumb;
}
}
private function read_file(/*string*/ $fname) {
$fp = fopen($fname, "r");
if(!$fp) return false;
$data = fread($fp, filesize($fname));
fclose($fp);
return $data;
}
// }}}
}
?>