CustomerRewardsRESTAPI/Model/ImageModel.php
2024-05-30 10:42:53 -05:00

78 lines
2.2 KiB
PHP

<?php
require_once PD . "/Model/Database.php";
require_once PD . "/Model/ModelTraits.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
*/
class ImageModel extends Database {
use ModelTraits;
public $memberId;
public $imagePath;
public $imageName;
public $imageType;
public $imageSize;
public $imageBlob;
public $uploadTo;
public $allowFileType;
public $fileName;
public $tempPath;
public $basename;
public $originalPath;
public $fileType;
function __construct() {
parent::__construct();
$this->uploadTo = PD . "\\public\\images\\";
//$this->uploadTo = PD . '/public/images/';
$this->allowFileType = array('jpg','png','jpeg','gif');
}
/* Process the uploaded image and store in database */
public function insertImage()
{
$query = "CALL insert_loyalty_member_image_proc";
$rowCount = $this->processImage($query, $this);
return $rowCount;
}
public function findImageByMemberId()
{
return $this->processQuery("SELECT loyalty_value_id,
loyalty_member_id,
loyalty_attribute_id,
loyalty_value_mime_type
FROM toast_schema.loyalty_value_blob
WHERE loyalty_member_id = ?", ["i", $this->memberId]);
}
public function findAllImages()
{
return $this->processQuery("SELECT
loyalty_value_id,
loyalty_member_id,
loyalty_attribute_id,
loyalty_value_mime_type
FROM toast_schema.loyalty_value_blob
ORDER BY loyalty_member_id ASC LIMIT ?", ["i", $this->limit]);
}
public function returnImageBlob()
{
}
}