Cześć. W czystym gd działa dobrze... Postanowiłem sam napisać prostą klasę która będzie szybsza niż w/w klasa. Pozdrawiam

Takie coś wystukałem:
<?php
class ImageClass {
private $ext;
//rozszerzenie obrazka
private $name;
//nazwa do zapisania
private $image;
//zmienna z obrazkiem
private $imageWidth;
private $imageHeight;
public function __construct($filename, $name, $ext) {
$this -> name = $name;
$this -> ext = $ext;
switch($this->ext) {
case ('jpg' OR 'jpeg') :
$this -> image = imagecreatefromjpeg($filename);
break;
case 'png' :
$this -> image = imagecreatefromjpeg($filename);
break;
case 'gif' :
$this -> image = imagecreatefromgif($filename);
break;
}
$this -> imageWidth = imagesx($this -> image);
$this -> imageHeight = imagesy($this -> image);
}
public function original($dir) {
$this -> save($dir, $this->image);
}
public function full($dir, $watermark) {
$img_full = imagecreatetruecolor($this->imageWidth, $this->imageHeight);
$watermark = imagecreatefrompng($watermark);
$watermarkWidth = imagesx($watermark);
$watermarkHeight = imagesy($watermark);
imagecopy($this->image, $watermark, ($this -> imageWidth / 2) - ($watermarkWidth / 2), ($this -> imageHeight / 2) - ($watermarkHeight / 2), 0, 0, $watermarkWidth, $watermarkHeight);
$this -> save($dir, $this->image);
}
public function mini($dir, $width, $height) {
if($this->imageWidth>$this->imageHeight) $height = $this->imageHeight/($this->imageWidth/$width); else $width = $this->imageWidth/($this->imageHeight/$height);
$img_mini = imagecreatetruecolor($width, $height);
imagecopyresampled($img_mini, $this -> image, 0, 0, 0, 0, $width, $height, $this -> imageWidth, $this -> imageHeight);
$this -> save($dir,$img_mini);
imagedestroy($img_mini);
}
private function save($dir, $image) {
$image = $this -> image;
switch($this->ext) {
case ('jpg' OR 'jpeg') :
imagejpeg($image, $dir . $this -> name.'.'.$this->ext, 80);
break;
case 'png' :
imagepng($image, $dir . $this -> name.'.'.$this->ext, 80);
break;
case 'gif' :
imagegif($image, $dir . $this -> name.'.'.$this->ext, 80);
break;
}
}
public function __destruct() {
imagedestroy($this->image);
}
}
$image = new ImageClass($filename, 'nowa_fotka', 'jpg');
$image -> original('./original/');
$image -> mini('./mini/', 200, 100);
$image -> full('./full/', './Data/other/watermark.png');
Dodam, że pisałem to pod swoje wymagania.