src/Controller/HomeController.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Entity\Image;
  4. use Symfony\Component\HttpFoundation\JsonResponse;
  5. use Symfony\Component\HttpFoundation\RedirectResponse;
  6. use Symfony\Component\HttpFoundation\Request;
  7. use Symfony\Component\Routing\Annotation\Route;
  8. class HomeController extends BaseController
  9. {
  10.     /**
  11.      * @Route("/", name="app.index")
  12.      */
  13.     public function index(): RedirectResponse
  14.     {
  15.         return $this->redirectToRoute("app_login");
  16.     }
  17.     /**
  18.      * @Route("/test-presta", name="app.test.presta")
  19.      */
  20.     public function testPresta(Request $request): JsonResponse
  21.     {
  22. //        $url = $this->getParameter('presta_api_url') . "/images/products/54";
  23. //        $image_path = $this->currentRequest->getSchemeAndHttpHost() . $this->getParameter('image_directory_prefix') . '427489_316711885038870-1650465182652.jpg';
  24. //
  25. //        $ch = curl_init();
  26. //        curl_setopt($ch, CURLOPT_URL, $url);
  27. //        curl_setopt($ch, CURLOPT_POST, true);
  28. //        curl_setopt($ch, CURLOPT_USERPWD, $this->getParameter('presta_api_key').':');
  29. //        curl_setopt($ch, CURLOPT_POSTFIELDS, ['image' => new CurlFile($image_path)]);
  30. //        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  31. //        $result = curl_exec($ch);
  32. //        curl_close($ch);
  33.         $currentRequest $this->getParameter('image_directory');
  34.         return new JsonResponse();
  35.     }
  36. }