2024-05-09 16:40:42 -05:00
|
|
|
<?php
|
2024-05-15 14:54:33 -05:00
|
|
|
require_once PD . "/Model/Database.php";
|
|
|
|
require_once PD . "/Model/ModelTraits.php";
|
2024-05-09 16:40:42 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Description of ImageModel
|
|
|
|
*
|
2024-05-13 14:36:49 -05:00
|
|
|
* @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-13 14:36:49 -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
|
|
|
|
2024-05-20 14:45:54 -05:00
|
|
|
public $memberId;
|
2024-05-29 01:59:54 -05:00
|
|
|
public $imagePath;
|
|
|
|
public $imageName;
|
|
|
|
public $imageType;
|
2024-05-29 12:27:49 -05:00
|
|
|
public $imageSize;
|
2024-05-20 14:45:54 -05:00
|
|
|
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() {
|
2024-05-29 14:47:51 -05:00
|
|
|
parent::__construct();
|
2024-05-20 14:45:54 -05:00
|
|
|
$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
|
|
|
{
|
2024-05-29 12:27:49 -05:00
|
|
|
$query = "CALL insert_loyalty_member_image_proc";
|
|
|
|
$rowCount = $this->processImage($query, $this);
|
2024-05-09 20:25:56 -05:00
|
|
|
return $rowCount;
|
2024-05-09 16:40:42 -05:00
|
|
|
}
|
2024-05-29 14:47:51 -05:00
|
|
|
|
|
|
|
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]);
|
|
|
|
}
|
2024-05-30 10:42:53 -05:00
|
|
|
|
|
|
|
public function returnImageBlob()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
2024-05-09 16:40:42 -05:00
|
|
|
}
|