From 51a9b9dfd6f8df176ade703afe2969051d4dbe3c Mon Sep 17 00:00:00 2001 From: afornerot Date: Sat, 2 Nov 2024 15:43:47 +0100 Subject: [PATCH] svg --- src/Controller/CropController.php | 9 +++++++ src/Controller/HomeController.php | 14 ----------- src/Controller/IllustrationController.php | 1 + src/Entity/Illustration.php | 17 +++++++++++++ templates/Home/home.html.twig | 28 +++------------------ templates/Home/user.html.twig | 28 +++------------------ templates/Illustration/list.html.twig | 2 +- templates/Illustration/listrender.html.twig | 2 +- 8 files changed, 35 insertions(+), 66 deletions(-) diff --git a/src/Controller/CropController.php b/src/Controller/CropController.php index 577e004..2cf74e3 100644 --- a/src/Controller/CropController.php +++ b/src/Controller/CropController.php @@ -91,6 +91,15 @@ class CropController extends AbstractController $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); + if($type=="illustration") { + $em = $this->getDoctrine()->getManager(); + $illustration=$em->getRepository("App:Illustration")->findOneBy(["illustration"=>$file]); + if($illustration) { + $illustration->setUpdatetime(new \DateTime()); + $em->flush(); + } + } + return $this->render('Crop/crop03.html.twig', [ 'useheader' => false, 'usesidebar' => false, diff --git a/src/Controller/HomeController.php b/src/Controller/HomeController.php index dbd1415..8687d32 100755 --- a/src/Controller/HomeController.php +++ b/src/Controller/HomeController.php @@ -13,20 +13,6 @@ class HomeController extends AbstractController { $em = $this->getDoctrine()->getManager(); - if($this->getUser()) { - // Entete - $headers = ['Accept' => 'application/json', 'key' => $this->getParameter("appNinegatesecret")]; - $query = []; - $url=$this->getParameter("appNinegateurl"); - // Paramétrage unirest - - \Unirest\Request::verifyPeer(false); - \Unirest\Request::verifyHost(false); - \Unirest\Request::timeout(5); - //dd($url.'/rest/user/'.$this->getUser()->getUsername()); - $response = \Unirest\Request::get($url.'/rest/user/'.$this->getUser()->getUsername(),$headers,["only"=>"user,groups"]); - } - $users = $em->getRepository("App:User")->findBy([],["pseudo"=>"ASC"]); $illustrations = $em->getRepository("App:Illustration")->findBy([],["submittime"=>"DESC"]); $links = $em->getRepository("App:Link")->findBy(["user"=>null]); diff --git a/src/Controller/IllustrationController.php b/src/Controller/IllustrationController.php index df2a3c7..cadfd09 100755 --- a/src/Controller/IllustrationController.php +++ b/src/Controller/IllustrationController.php @@ -81,6 +81,7 @@ class IllustrationController extends AbstractController if ($form->get('submit')->isClicked() && $form->isValid()) { $data = $form->getData(); $data->setSubmittime(new \DateTime()); + $data->setUpdatetime(new \DateTime()); $em->persist($data); $em->flush(); diff --git a/src/Entity/Illustration.php b/src/Entity/Illustration.php index 6e5e874..87852cd 100644 --- a/src/Entity/Illustration.php +++ b/src/Entity/Illustration.php @@ -34,6 +34,11 @@ class Illustration */ private $submittime; + /** + * @ORM\Column(type="datetime") + */ + private $updatetime; + /** * @ORM\Column(type="integer") */ @@ -95,6 +100,18 @@ class Illustration return $this; } + public function getUpdatetime(): ?\DateTimeInterface + { + return $this->updatetime; + } + + public function setUpdatetime(\DateTimeInterface $updatetime): self + { + $this->updatetime = $updatetime; + + return $this; + } + public function getWidth(): ?int { return $this->width; diff --git a/templates/Home/home.html.twig b/templates/Home/home.html.twig index 0fc0ab4..b8d12e4 100644 --- a/templates/Home/home.html.twig +++ b/templates/Home/home.html.twig @@ -310,9 +310,9 @@ {% if appthumbheight!=0 %} {% set source="thumbori_"~illustration.illustration %} {% endif %} - + {% set source=source~"?"~illustration.updatetime|date('ymdHis') %} -
+
{% endfor %} @@ -338,7 +338,7 @@ {% set class=" grid-item-size-2 grid-item-size-page" %} -
+
{% endif %} @@ -393,28 +393,6 @@ {% endblock %} {% block localjavascript %} -function getNoCacheBgElements() { - return document.querySelectorAll('.no-cache-bg'); -} - -function loadBgImageForElement(element) { - element.style['background-image'] = - 'url('+ element.attributes['data-background-image'].value + '?' + (new Date()).getTime() +')'; -} - -function loadBgImages() { - for( - var i = 0, elements = getNoCacheBgElements(); - i < elements.length; - loadBgImageForElement(elements[i]), i++ - ); -} - - -window.onload = function() { - loadBgImages(); -}; - $(document).ready(function() { $('body').imagesLoaded(function() { height=Math.max(500,$(window).height()); diff --git a/templates/Home/user.html.twig b/templates/Home/user.html.twig index fbf6f28..f94e503 100644 --- a/templates/Home/user.html.twig +++ b/templates/Home/user.html.twig @@ -281,10 +281,10 @@ {% if appthumbheight!=0 %} {% set source="thumbori_"~illustration.illustration %} {% endif %} - + {% set source=source~"?"~illustration.updatetime|date('ymdHis') %} -
+
{% endfor %} @@ -311,7 +311,7 @@ {% set class=" grid-item-size-2 grid-item-size-page" %} -
+
{% endif %} @@ -400,28 +400,6 @@ {% endblock %} {% block localjavascript %} -function getNoCacheBgElements() { - return document.querySelectorAll('.no-cache-bg'); -} - -function loadBgImageForElement(element) { - element.style['background-image'] = - 'url('+ element.attributes['data-background-image'].value + '?' + (new Date()).getTime() +')'; -} - -function loadBgImages() { - for( - var i = 0, elements = getNoCacheBgElements(); - i < elements.length; - loadBgImageForElement(elements[i]), i++ - ); -} - - -window.onload = function() { - loadBgImages(); -}; - $(document).ready(function() { $('body').imagesLoaded(function() { height=Math.max(500,$(window).height()); diff --git a/templates/Illustration/list.html.twig b/templates/Illustration/list.html.twig index b645fa9..80ca6b4 100644 --- a/templates/Illustration/list.html.twig +++ b/templates/Illustration/list.html.twig @@ -57,7 +57,7 @@ ILLUSTRATIONS {% set height=30*90/21 %} {% endif %} -
+
diff --git a/templates/Illustration/listrender.html.twig b/templates/Illustration/listrender.html.twig index ce8609d..20a502b 100644 --- a/templates/Illustration/listrender.html.twig +++ b/templates/Illustration/listrender.html.twig @@ -43,7 +43,7 @@ {% set height=30*90/21 %} {% endif %} -
+
{{ illustration.submittime|date("Y-m-d H:i") }}