45 lines
1.1 KiB
PHP
45 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace api\classes;
|
|
|
|
use api\classes\API;
|
|
use api\classes\imageProcessor;
|
|
|
|
require_once 'API.php';
|
|
|
|
class API_usersavatar extends API
|
|
{
|
|
|
|
public function createUserImage($imageRestrictions)
|
|
{
|
|
try {
|
|
# Main image
|
|
$imageProcessor = new imageProcessor('user_profile_picture');
|
|
$imageProcessor->imageRestrictions = $imageRestrictions;
|
|
$imageProcessor->validateAndProcess();
|
|
$ImageData = $imageProcessor->returnBase64image();
|
|
} catch (Exception $e) {
|
|
$this->apiOutput(401, ['error' => 'Error: ' . $e->getMessage()]);
|
|
}
|
|
|
|
return $ImageData;
|
|
}
|
|
|
|
public function updateUserImage()
|
|
{
|
|
$query = "UPDATE vc_users SET
|
|
user_profile_picture = ?,
|
|
user_profile_picture_thumbnail = ?
|
|
WHERE user_uuid = ?";
|
|
|
|
$stmt = $stmt = $this->prepareStatement($query);
|
|
$stmt->bind_param("sss",
|
|
$this->data['user_profile_picture'],
|
|
$this->data['user_profile_picture_thumbnail'],
|
|
$this->data['user_uuid']
|
|
);
|
|
$this->executeStatement($stmt);
|
|
|
|
}
|
|
|
|
} |