<?php
namespace App\Controller;
use App\Entity\Image;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
class HomeController extends BaseController
{
/**
* @Route("/", name="app.index")
*/
public function index(): RedirectResponse
{
return $this->redirectToRoute("app_login");
}
/**
* @Route("/test-presta", name="app.test.presta")
*/
public function testPresta(Request $request): JsonResponse
{
// $url = $this->getParameter('presta_api_url') . "/images/products/54";
// $image_path = $this->currentRequest->getSchemeAndHttpHost() . $this->getParameter('image_directory_prefix') . '427489_316711885038870-1650465182652.jpg';
//
// $ch = curl_init();
// curl_setopt($ch, CURLOPT_URL, $url);
// curl_setopt($ch, CURLOPT_POST, true);
// curl_setopt($ch, CURLOPT_USERPWD, $this->getParameter('presta_api_key').':');
// curl_setopt($ch, CURLOPT_POSTFIELDS, ['image' => new CurlFile($image_path)]);
// curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// $result = curl_exec($ch);
// curl_close($ch);
$currentRequest = $this->getParameter('image_directory');
return new JsonResponse();
}
}