fix devops error

This commit is contained in:
ludo
2024-01-05 01:30:46 +01:00
parent 90b0af5b2d
commit 5144c1f7fd
128 changed files with 410 additions and 2580 deletions

View File

@@ -3,38 +3,31 @@
namespace App\Repositories\Core;
use Illuminate\Support\Facades\Storage;
use Intervention\Image\Facades\Image as Image;
use Intervention\Image\Facades\Image;
class Upload
{
public static function getData($file)
{
$data['filename'] = $file->getClientOriginalName();
$data['filetype'] = $file->getClientOriginalExtension();
$data['filesize'] = $file->getSize();
$data['mime'] = $file->getMimeType();
return $data;
return [
'filename' => $file->getClientOriginalName(),
'filetype' => $file->getClientOriginalExtension(),
'filesize' => $file->getSize(),
'mime' => $file->getMimeType(),
];
}
public static function getUuid($file, $data)
{
$data = (is_array($data)) ? (object) $data : $data;
$data = is_array($data) ? (object) $data : $data;
$pos = strrpos($file, '/');
$uuid = substr($file, $pos + 1);
$uuid = pathinfo($uuid, PATHINFO_FILENAME);
return $uuid;
return pathinfo($uuid, PATHINFO_FILENAME);
}
public static function storeByVar($var, $path, $public = false)
{
// check if filename exists
// store
// Storage::disk('local')->put('file.txt', 'Contents');
// $path = Storage::putFile('avatars', $request->file('avatar'));
// $path = $request->file('avatar')->storeAs('avatars',$request->user()->id,'s3');
// $path = $request->file('avatar')->storePublicly('avatars', 's3');
$request = Request();
return $request->has($var) ? basename($request->file($var)->store($path)) : false;
@@ -43,14 +36,11 @@ class Upload
public static function store($file, $path)
{
return Storage::putFile($path, $file);
// return $file->store($filepath);
}
public static function storePublic($file, $filepath)
{
return Storage::putFile($filepath, $file, 'public');
// $filepath = 'public/' . $filepath;
// return $file->store($filepath);
}
public static function createThumb($file, $size, $sub = false)
@@ -61,12 +51,6 @@ class Upload
return Image::make($filename)->orientate()->widen($size)->save($thumb);
}
/*
public static function getPath($file) {
return 'public/' . self::getFilename($file);
}
*/
public static function getPublicPath($file)
{
return storage_path('app/public/'.self::getFilename($file));
@@ -94,7 +78,7 @@ class Upload
public static function getFilename($file)
{
$file = (is_array($file)) ? (object) $file : $file;
$file = is_array($file) ? (object) $file : $file;
return $file->filepath.'/'.self::getName($file);
}
@@ -102,24 +86,18 @@ class Upload
public static function getThumbFilename($file, $sub = false)
{
$sub = $sub ? $sub : 'thumbs/';
$file = (is_array($file)) ? (object) $file : $file;
$file = is_array($file) ? (object) $file : $file;
return $file->filepath.'/'.$sub.self::getName($file);
}
public static function getName($file)
{
$file = (is_array($file)) ? (object) $file : $file;
$file = is_array($file) ? (object) $file : $file;
return $file->uuid.'.'.strtolower($file->filetype);
}
/**
* [fix problem path with Storage on Windows]
*
* @param [type] $path [description]
* @return [type] [description]
*/
public static function fix($path)
{
if (! self::isWindows()) {