protected function createImage($new, $img = null, $q = null)
{
if (is_string($new)) {
$new = imagecreatefromstring($new);
}
switch ($this->mime) {
case 'image/gif':
imagegif($new, $img);
break;
case 'image/png':
if (null !== $q) {
imagepng($new, $img, $q);
} else {
imagepng($new, $img);
}
break;
case 'image/jpeg':
imagejpeg($new, $img, $q);
break;
}
}