CustomerRewardsRESTAPI/Model/ImageModel.php

55 lines
1.5 KiB
PHP
Raw Normal View History

2024-05-09 16:40:42 -05:00
<?php
require_once PD . "/Model/Database.php";
require_once PD . "/Model/ModelTraits.php";
2024-05-09 16:40:42 -05:00
/**
* 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
2024-05-09 16:40:42 -05:00
*/
2024-05-09 16:40:42 -05:00
class ImageModel extends Database {
2024-05-09 20:25:56 -05:00
use ModelTraits;
2024-05-09 16:40:42 -05:00
public $memberId;
public $imageBlob;
2024-05-14 11:38:57 -05:00
public $uploadTo;
public $allowFileType;
public $fileName;
public $tempPath;
public $basename;
public $originalPath;
public $fileType;
function __construct() {
$this->uploadTo = PD . "\\public\\images\\";
//$this->uploadTo = PD . '/public/images/';
2024-05-14 11:38:57 -05:00
$this->allowFileType = array('jpg','png','jpeg','gif');
}
/* Process the uploaded image and store in database */
public function insertImage()
2024-05-09 16:40:42 -05:00
{
//$sql = "INSERT INTO ImageStore(ImageId,Image) VALUES('$this->image_id','" . mysql_escape_string(file_get_contents($tmp_image)) . "')";
//$fp=addslashes(file_get_contents($_FILES['image']['tmp_name'])); //will store the image to fp
//$query = "CALL insert_loyalty_member_image_proc('{$fileName}','{$fp}');";
$query .= "CALL insert_loyalty_member_image_proc (" . $this->memberId . ", " . $this->imageBlob . ")";
2024-05-09 20:25:56 -05:00
//return var_dump($query);
$rowCount = $this->processImage($query);
return $rowCount;
2024-05-09 16:40:42 -05:00
}
}