fix(continuous-integration): correction php-cs-fixer
All checks were successful
Cadoles/nineskeletor/pipeline/pr-master This commit looks good
All checks were successful
Cadoles/nineskeletor/pipeline/pr-master This commit looks good
This commit is contained in:
@ -2,12 +2,12 @@
|
||||
|
||||
namespace App\Controller;
|
||||
|
||||
use App\Service\MinioService;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use App\Service\MinioService;
|
||||
use Symfony\Component\HttpKernel\KernelInterface;
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
|
||||
class MinioController extends AbstractController
|
||||
{
|
||||
@ -20,54 +20,54 @@ class MinioController extends AbstractController
|
||||
$this->minio = $minio;
|
||||
}
|
||||
|
||||
public function ckupload($access,Request $request): Response
|
||||
public function ckupload($access, Request $request): Response
|
||||
{
|
||||
// Fichier temporaire uploadé
|
||||
$tmpfile = $request->files->get('upload');
|
||||
$extention = $tmpfile->getClientOriginalExtension();
|
||||
$tmpfile = $request->files->get('upload');
|
||||
$extention = $tmpfile->getClientOriginalExtension();
|
||||
|
||||
// Répertoire de Destination
|
||||
$fs = new Filesystem();
|
||||
$rootdir = $this->getParameter('kernel.project_dir') . '/var/tmp';
|
||||
$fs->mkdir($rootdir."/ckeditor");
|
||||
|
||||
// Fichier cible
|
||||
$targetName = uniqid().".".$extention;
|
||||
$targetFile = "ckeditor/".$targetName;
|
||||
$targetUrl = $this->generateUrl('app_minio_document',["file"=>"ckeditor/".$targetName]);
|
||||
$fs = new Filesystem();
|
||||
$rootdir = $this->getParameter('kernel.project_dir').'/var/tmp';
|
||||
$fs->mkdir($rootdir.'/ckeditor');
|
||||
|
||||
//move_uploaded_file($tmpfile,$targetFile);
|
||||
$this->minio->upload($tmpfile,$targetFile,true);
|
||||
|
||||
$output["uploaded"]=1;
|
||||
$output["fileName"]=$targetName;
|
||||
$output["url"]=$targetUrl;
|
||||
// Fichier cible
|
||||
$targetName = uniqid().'.'.$extention;
|
||||
$targetFile = 'ckeditor/'.$targetName;
|
||||
$targetUrl = $this->generateUrl('app_minio_document', ['file' => 'ckeditor/'.$targetName]);
|
||||
|
||||
// move_uploaded_file($tmpfile,$targetFile);
|
||||
$this->minio->upload($tmpfile, $targetFile, true);
|
||||
|
||||
$output['uploaded'] = 1;
|
||||
$output['fileName'] = $targetName;
|
||||
$output['url'] = $targetUrl;
|
||||
|
||||
return new Response(json_encode($output));
|
||||
}
|
||||
|
||||
public function logo(Request $request): Response {
|
||||
|
||||
return $this->redirectToRoute("app_minio_image",["file"=>"logo/".$request->getSession()->get("logolight")]);
|
||||
public function logo(Request $request): Response
|
||||
{
|
||||
return $this->redirectToRoute('app_minio_image', ['file' => 'logo/'.$request->getSession()->get('logolight')]);
|
||||
}
|
||||
|
||||
public function image(Request $request): Response
|
||||
{
|
||||
$file=$request->query->get("file");
|
||||
switch($file) {
|
||||
case "avatar/admin.jpg":
|
||||
case "avatar/noavatar.png":
|
||||
case "avatar/system.jpg":
|
||||
case "header/header.jpg":
|
||||
case "logo/logo.png":
|
||||
$file = "medias/".$file;
|
||||
$file = $request->query->get('file');
|
||||
switch ($file) {
|
||||
case 'avatar/admin.jpg':
|
||||
case 'avatar/noavatar.png':
|
||||
case 'avatar/system.jpg':
|
||||
case 'header/header.jpg':
|
||||
case 'logo/logo.png':
|
||||
$file = 'medias/'.$file;
|
||||
$filePath = $file;
|
||||
$content = file_get_contents($file);
|
||||
break;
|
||||
break;
|
||||
|
||||
default:
|
||||
// C'est une url = on affiche l'url
|
||||
if(stripos($file,"http")===0) {
|
||||
if (0 === stripos($file, 'http')) {
|
||||
$filePath = $file;
|
||||
$content = file_get_contents($file);
|
||||
}
|
||||
@ -76,7 +76,7 @@ class MinioController extends AbstractController
|
||||
$filePath = $this->minio->download($file, $file, true);
|
||||
$content = file_get_contents($filePath);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
return new Response($content, 200, [
|
||||
@ -88,7 +88,7 @@ class MinioController extends AbstractController
|
||||
|
||||
public function document(Request $request)
|
||||
{
|
||||
$file=$request->query->get("file");
|
||||
$file = $request->query->get('file');
|
||||
$filePath = $this->minio->download($file, $file, true);
|
||||
$content = file_get_contents($filePath);
|
||||
|
||||
|
Reference in New Issue
Block a user