$this->signatory_model->updateSignature($this->signatoryID, $imagepath); $this->template->assign('signatureImage', $imagepath); $this->template->assign('hasImageSet', '1'); $this->template->setAlert('Signature image has been successfully uploaded.', Template::ALERT_SUCCESS); } else { $this->template->setAlert('An error occured while uploading the image.' . $image_upload->error, Template::ALERT_INFO); } } else { $this->template->setAlert('An error occured while uploading the image.', Template::ALERT_INFO); } } else { $this->template->setAlert('Invalid image! The image must be of valid file type (jpg, png, or gif), has exactly 200x35 size, and is less than 1 MB.', Template::ALERT_ERROR, 'alert'); //return; } } public function reset() { $sigIm = $this->signatory_model->getSignature($this->signatoryID); $sigIm = parse_url($sigIm, PHP_URL_PATH); $sigIm = substr($sigIm, strrpos($sigIm, "/") + 1); $sigIm = PATH . "photos/signatures/" . $sigIm; unlink($sigIm); $this->signatory_model->resetSignature($this->signatoryID); $this->template->assign('signatureImage', HOST . "/photos/default_signature.jpg"); $this->template->assign('hasImageSet', '0'); $this->template->setAlert('Signature image has been removed.', Template::ALERT_SUCCESS); } } $controller = new UploadSignature(); $controller->perform_actions(); $controller->display();