You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
591 B
PHTML
31 lines
591 B
PHTML
4 years ago
|
<?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;
|
||
|
}
|
||
|
}
|