After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 147 KiB |
After Width: | Height: | Size: 147 KiB |
After Width: | Height: | Size: 147 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 74 KiB |
After Width: | Height: | Size: 2.5 MiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 147 KiB |
After Width: | Height: | Size: 2.5 MiB |
After Width: | Height: | Size: 147 KiB |
After Width: | Height: | Size: 2.5 MiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 2.5 MiB |
After Width: | Height: | Size: 54 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 2.5 MiB |
After Width: | Height: | Size: 2.5 MiB |
After Width: | Height: | Size: 2.5 MiB |
After Width: | Height: | Size: 45 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 2.5 MiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 147 KiB |
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\gateway;
|
||||
class ImageSaver
|
||||
{
|
||||
|
||||
public static function getId() : int
|
||||
{
|
||||
return rand(10000,19999);
|
||||
}
|
||||
|
||||
public static function SaveImage(string $filename) : array
|
||||
{
|
||||
try {
|
||||
$return=[];
|
||||
|
||||
$name = substr($_FILES[$filename]["name"], 0, 45);
|
||||
$name = self::getId().$name;
|
||||
|
||||
move_uploaded_file($_FILES[$filename]['tmp_name'], "../public/uploads/$name");
|
||||
$return[]=true;
|
||||
$return[]=$name;
|
||||
return $return;
|
||||
} catch (\Exception $e) {
|
||||
$return[] = false;
|
||||
$return[] = "";
|
||||
return $return;
|
||||
}
|
||||
}
|
||||
}
|