/** * Determines whether the image file exists * * @return boolean */ public function isImageExists() { $imagePath = Fox_Member_Model_Member::getImageUploadPath(); return Fox::getLoggedMember()->getMemberImage() && file_exists($imagePath . DIRECTORY_SEPARATOR . Fox::getLoggedMember()->getMemberImage()); }
/** * Remove image action */ public function removeImageAction() { $memberModel = Fox::getModel('member/member'); $memberModel->getAdapter()->beginTransaction(); try { $memberData = Fox::getLoggedMember(); $memberModel->load($memberData->getId()); $path = Fox_Member_Model_Member::getImageUploadPath(); $prevImage = $memberModel->getMemberImage(); $memberModel->setMemberImage(''); $memberModel->save(); $memberModel->getAdapter()->commit(); if ($prevImage && file_exists($path . DIRECTORY_SEPARATOR . $prevImage)) { @unlink($path . DIRECTORY_SEPARATOR . $prevImage); } Fox::getModel('member/session')->setLoginData($memberModel); Fox::getHelper('core/message')->setInfo('Profile image was successfully removed.'); } catch (Exception $e) { $memberModel->getAdapter()->rollback(); Fox::getHelper('core/message')->setError($e->getMessage()); } $this->sendRedirect('*/*/edit-image'); }