mirror of
https://github.com/sctn4elk/CustomerRewardsRESTAPI.git
synced 2025-01-10 09:24:31 -06:00
Work on member image
This commit is contained in:
parent
49dd152914
commit
12384fc2d6
|
@ -40,13 +40,16 @@ class ImageController extends BaseController {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "update":
|
case "update":
|
||||||
$response = $this->updateImage();
|
$response = $this->updateImage();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "delete":
|
case "delete":
|
||||||
$response = $this->deleteImage();
|
$response = $this->deleteImage();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case "blob":
|
||||||
|
$response = $this->blobImage();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
$response = (object) ['Result' => 'Default'];
|
$response = (object) ['Result' => 'Default'];
|
||||||
$this->strErrorDesc = 'Controller Method not supported for processAction: ' . $this->action;
|
$this->strErrorDesc = 'Controller Method not supported for processAction: ' . $this->action;
|
||||||
|
@ -156,7 +159,7 @@ class ImageController extends BaseController {
|
||||||
|
|
||||||
private function handleImage() {
|
private function handleImage() {
|
||||||
$moved = false;
|
$moved = false;
|
||||||
if(move_uploaded_file($this->imageModel->tempPath, $this->imageModel->uploadTo . $this->imageModel->memberId)) {
|
if(move_uploaded_file($this->imageModel->tempPath, $this->imageModel->uploadTo . $this->imageModel->memberId . '.' . $this->imageModel->fileType)) {
|
||||||
$moved = true;
|
$moved = true;
|
||||||
}
|
}
|
||||||
return $moved;
|
return $moved;
|
||||||
|
@ -216,6 +219,14 @@ class ImageController extends BaseController {
|
||||||
return $this->unprocessableRequestResponse("deleteImage is not implemented");
|
return $this->unprocessableRequestResponse("deleteImage is not implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function blobImage(){
|
||||||
|
if ($this->checkRequestType('GET') == 'false') {
|
||||||
|
return $this->unprocessableRequestResponse("Request type is not GET");
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->unprocessableRequestResponse("updateImage is not implemented");
|
||||||
|
}
|
||||||
|
|
||||||
private function validateImage(){
|
private function validateImage(){
|
||||||
$validtion = false;
|
$validtion = false;
|
||||||
if(in_array($this->imageModel->fileType, $this->imageModel->allowFileType)){
|
if(in_array($this->imageModel->fileType, $this->imageModel->allowFileType)){
|
||||||
|
|
|
@ -73,11 +73,6 @@ class Database {
|
||||||
public function processImage($query, $imageModel) {
|
public function processImage($query, $imageModel) {
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
/*if($this->connection == null)
|
|
||||||
{
|
|
||||||
$this->connection = new mysqli(DB_HOST, DB_USERNAME, DB_PASSWORD, DB_DATABASE_NAME);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
$data = $this->connection->real_escape_string($imageModel->imageBlob);
|
$data = $this->connection->real_escape_string($imageModel->imageBlob);
|
||||||
$result = $this->connection->query($query."(".$imageModel->memberId.", '".$imageModel->imageType."', '".$data."')");
|
$result = $this->connection->query($query."(".$imageModel->memberId.", '".$imageModel->imageType."', '".$data."')");
|
||||||
|
|
||||||
|
|
|
@ -69,4 +69,9 @@ class ImageModel extends Database {
|
||||||
FROM toast_schema.loyalty_value_blob
|
FROM toast_schema.loyalty_value_blob
|
||||||
ORDER BY loyalty_member_id ASC LIMIT ?", ["i", $this->limit]);
|
ORDER BY loyalty_member_id ASC LIMIT ?", ["i", $this->limit]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function returnImageBlob()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user