mise en place de minio
This commit is contained in:
@ -9,14 +9,17 @@ use Symfony\Component\Form\Extension\Core\Type\HiddenType;
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
use Symfony\Component\HttpKernel\KernelInterface;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use App\Service\MinioService;
|
||||
|
||||
class CropController extends AbstractController
|
||||
{
|
||||
private $appKernel;
|
||||
private $minio;
|
||||
|
||||
public function __construct(KernelInterface $appKernel)
|
||||
public function __construct(KernelInterface $appKernel, MinioService $minio)
|
||||
{
|
||||
$this->appKernel = $appKernel;
|
||||
$this->minio = $minio;
|
||||
}
|
||||
|
||||
// Etape 01 - Téléchargement de l'image
|
||||
@ -102,6 +105,11 @@ class CropController extends AbstractController
|
||||
$data = $form->getData();
|
||||
$thumb_image_location = "uploads/$type/thumb_".$file;
|
||||
$cropped = $this->resizeThumbnailImage($thumb_image_location, $large_image_location,$data["ws"],$data["hs"],$data["xs"],$data["ys"],$scale);
|
||||
|
||||
// Dépot des fichiers sur minio
|
||||
$this->minio->upload($large_image_location,$large_image_location,true);
|
||||
$this->minio->upload($thumb_image_location,$thumb_image_location,true);
|
||||
|
||||
$submited=true;
|
||||
}
|
||||
|
||||
@ -117,32 +125,6 @@ class CropController extends AbstractController
|
||||
]);
|
||||
}
|
||||
|
||||
// Upload ckeditor
|
||||
public function ckupload(Request $request) {
|
||||
// Fichier temporaire uploadé
|
||||
$tmpfile = $request->files->get('upload');
|
||||
$extention = $tmpfile->getClientOriginalExtension();
|
||||
|
||||
// Répertoire de Destination
|
||||
$fs = new Filesystem();
|
||||
$rootdir = $this->appKernel->getProjectDir()."/public";
|
||||
$fs->mkdir($rootdir."/uploads/ckeditor");
|
||||
|
||||
// Fichier cible
|
||||
$targetName = uniqid().".".$extention;
|
||||
$targetFile = $rootdir."/uploads/ckeditor/".$targetName;
|
||||
$targetUrl = "/".$this->getParameter('appAlias')."/uploads/ckeditor/".$targetName;
|
||||
$message = "";
|
||||
|
||||
move_uploaded_file($tmpfile,$targetFile);
|
||||
|
||||
$output["uploaded"]=1;
|
||||
$output["fileName"]=$targetName;
|
||||
$output["url"]=$targetUrl;
|
||||
|
||||
return new Response(json_encode($output));
|
||||
}
|
||||
|
||||
// Calcul de la hauteur
|
||||
protected function getHeight($image) {
|
||||
$size = getimagesize($image);
|
||||
|
Reference in New Issue
Block a user