mirror of
https://github.com/sctn4elk/CustomerRewardsRESTAPI.git
synced 2025-01-09 23:14:29 -06:00
0cecde088c
This reverts commit 0a78c4fddc
.
57 lines
1.5 KiB
PHP
57 lines
1.5 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Description of ImageModel
|
|
*
|
|
* @author Mike Howard
|
|
*
|
|
* Table: loyalty_value_blob
|
|
* Columns:
|
|
* loyalty_value_id bigint PK
|
|
* loyalty_member_id bigint
|
|
* loyalty_attribute_id bigint
|
|
* loyalty_value_mime_type varchar(255)
|
|
* loyalty_value_blob blob
|
|
*/
|
|
|
|
define('PD', 'D:\DEV\Git Repository\CustomerRewardsRESTAPI');
|
|
require_once PD . "/Model/Database.php";
|
|
require_once PD . "/Model/ModelTraits.php";
|
|
|
|
class ImageModel extends Database {
|
|
use ModelTraits;
|
|
|
|
public $uploadTo;
|
|
public $allowFileType;
|
|
public $fileName;
|
|
public $tempPath;
|
|
public $basename;
|
|
public $originalPath;
|
|
public $fileType;
|
|
|
|
function __construct() {
|
|
$this->uploadTo = "public/images/";
|
|
$this->allowFileType = array('jpg','png','jpeg','gif');
|
|
}
|
|
|
|
/* Process the uploaded image and store in database */
|
|
public function insertImage()
|
|
{
|
|
//return var_dump($jsonPayLoad);
|
|
$keys = array_keys($inputModel);
|
|
$n = count($keys);
|
|
|
|
//$sql = "INSERT INTO ImageStore(ImageId,Image) VALUES('$this->image_id','" . mysql_escape_string(file_get_contents($tmp_image)) . "')";
|
|
|
|
$query .= "CALL insert_loyalty_member_image_proc (" . $inputModel[$keys[0]] . ", ";
|
|
for($i = 0; $i < $n-1; $i++) {
|
|
$query .= "'" . $inputModel[$keys[$i]] . "', ";
|
|
}
|
|
$query .= $inputModel[$keys[$i]] . ")";
|
|
//return var_dump($query);
|
|
|
|
$rowCount = $this->processImage($query);
|
|
return $rowCount;
|
|
}
|
|
}
|