protected function _do_save($file, $quality)
{
// Loads image if not yet loaded
$this->_load_image();
// Get the extension of the file
$extension = pathinfo($file, PATHINFO_EXTENSION);
// Get the save function and IMAGETYPE
list($save, $type) = $this->_save_function($extension, $quality);
// Save the image to a file
$status = isset($quality) ? $save($this->_image, $file, $quality) : $save($this->_image, $file);
if ($status === TRUE and $type !== $this->type) {
// Reset the image type and mime type
$this->type = $type;
$this->mime = image_type_to_mime_type($type);
}
return TRUE;
}