fipamo/brain/api/v1/ImagesAPI.inc.php

31 lines
591 B
PHP

<?php
class ImagesAPI
{
public function __construct()
{
}
public static function uploadImage($request)
{
$image = $request->getUploadedFiles();
$path = date("Y") . "/" . date("m");
$uploadPath = "../public/assets/images/blog/" . $path;
FileUploader::uploadFile($uploadPath, $image["post_image"]);
$response = [
"message" => "Image Added. Very slick",
"type" => "postImageAdded",
"url" =>
"/assets/images/blog/" .
$path .
"/" .
$image["post_image"]->getClientFileName(),
];
return $response;
}
}