This commit is contained in:
afornerot 2024-11-02 15:43:47 +01:00
parent 829e99318b
commit 51a9b9dfd6
8 changed files with 35 additions and 66 deletions

View File

@ -91,6 +91,15 @@ class CropController extends AbstractController
$thumb_image_location = "uploads/$type/thumb_".$file; $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); $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', [ return $this->render('Crop/crop03.html.twig', [
'useheader' => false, 'useheader' => false,
'usesidebar' => false, 'usesidebar' => false,

View File

@ -13,20 +13,6 @@ class HomeController extends AbstractController
{ {
$em = $this->getDoctrine()->getManager(); $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"]); $users = $em->getRepository("App:User")->findBy([],["pseudo"=>"ASC"]);
$illustrations = $em->getRepository("App:Illustration")->findBy([],["submittime"=>"DESC"]); $illustrations = $em->getRepository("App:Illustration")->findBy([],["submittime"=>"DESC"]);
$links = $em->getRepository("App:Link")->findBy(["user"=>null]); $links = $em->getRepository("App:Link")->findBy(["user"=>null]);

View File

@ -81,6 +81,7 @@ class IllustrationController extends AbstractController
if ($form->get('submit')->isClicked() && $form->isValid()) { if ($form->get('submit')->isClicked() && $form->isValid()) {
$data = $form->getData(); $data = $form->getData();
$data->setSubmittime(new \DateTime()); $data->setSubmittime(new \DateTime());
$data->setUpdatetime(new \DateTime());
$em->persist($data); $em->persist($data);
$em->flush(); $em->flush();

View File

@ -34,6 +34,11 @@ class Illustration
*/ */
private $submittime; private $submittime;
/**
* @ORM\Column(type="datetime")
*/
private $updatetime;
/** /**
* @ORM\Column(type="integer") * @ORM\Column(type="integer")
*/ */
@ -95,6 +100,18 @@ class Illustration
return $this; return $this;
} }
public function getUpdatetime(): ?\DateTimeInterface
{
return $this->updatetime;
}
public function setUpdatetime(\DateTimeInterface $updatetime): self
{
$this->updatetime = $updatetime;
return $this;
}
public function getWidth(): ?int public function getWidth(): ?int
{ {
return $this->width; return $this->width;

View File

@ -310,9 +310,9 @@
{% if appthumbheight!=0 %} {% if appthumbheight!=0 %}
{% set source="thumbori_"~illustration.illustration %} {% set source="thumbori_"~illustration.illustration %}
{% endif %} {% endif %}
{% set source=source~"?"~illustration.updatetime|date('ymdHis') %}
<a href="{{ path("app_illustration_view",{"by":"home","idcat":illustration.category.id,"id":illustration.id}) }}"> <a href="{{ path("app_illustration_view",{"by":"home","idcat":illustration.category.id,"id":illustration.id}) }}">
<div id="illustration{{illustration.id}}" class="grid-item grid-item-size {{class}} {{classmini}} cssfilter no-cache-bg" data-width="{{illustration.width}}" data-background-image="/{{ appAlias }}/uploads/illustration/{{source}}" data-height="{{illustration.height}}" style="height:auto;background-position: center ; background-size: cover; background-image: url(/{{ appAlias }}/uploads/illustration/{{source}}");"> <div id="illustration{{illustration.id}}" class="grid-item grid-item-size {{class}} {{classmini}} cssfilter" data-width="{{illustration.width}}" data-background-image="/{{ appAlias }}/uploads/illustration/{{source}}" data-height="{{illustration.height}}" style="height:auto;background-position: center ; background-size: cover; background-image: url(/{{ appAlias }}/uploads/illustration/{{source}}");">
</div> </div>
</a> </a>
{% endfor %} {% endfor %}
@ -338,7 +338,7 @@
{% set class=" grid-item-size-2 grid-item-size-page" %} {% set class=" grid-item-size-2 grid-item-size-page" %}
<a href="{{ path("app_webzine_view",{"by":"home","idcat":webzine.id,"id":page.id}) }}"> <a href="{{ path("app_webzine_view",{"by":"home","idcat":webzine.id,"id":page.id}) }}">
<div id="webzine{{webzine.id}}" class="grid-item grid-item-size {{class}} cssfilter no-cache-bg" data-width="{{page.width}}" data-background-image="/{{ appAlias }}/uploads/webzine/{{source}}" data-height="{{page.height}}" style="height:auto;background-position: center ; background-size: cover; background-image: url(/{{ appAlias }}/uploads/webzine/{{source}}");"> <div id="webzine{{webzine.id}}" class="grid-item grid-item-size {{class}} cssfilter" data-width="{{page.width}}" data-background-image="/{{ appAlias }}/uploads/webzine/{{source}}" data-height="{{page.height}}" style="height:auto;background-position: center ; background-size: cover; background-image: url(/{{ appAlias }}/uploads/webzine/{{source}}");">
</div> </div>
</a> </a>
{% endif %} {% endif %}
@ -393,28 +393,6 @@
{% endblock %} {% endblock %}
{% block localjavascript %} {% 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() { $(document).ready(function() {
$('body').imagesLoaded(function() { $('body').imagesLoaded(function() {
height=Math.max(500,$(window).height()); height=Math.max(500,$(window).height());

View File

@ -281,10 +281,10 @@
{% if appthumbheight!=0 %} {% if appthumbheight!=0 %}
{% set source="thumbori_"~illustration.illustration %} {% set source="thumbori_"~illustration.illustration %}
{% endif %} {% endif %}
{% set source=source~"?"~illustration.updatetime|date('ymdHis') %}
<a href="{{ path("app_illustration_view",{"by":"user","idcat":category.id,"id":illustration.id}) }}"> <a href="{{ path("app_illustration_view",{"by":"user","idcat":category.id,"id":illustration.id}) }}">
<div id="illustration{{illustration.id}}" class="grid-item grid-item-size {{class}} {{classmini}} cssfilter cssfilter-{{category.id}} no-cache-bg" data-width="{{illustration.width}}" data-background-image="/{{ appAlias }}/uploads/illustration/{{source}}" data-height="{{illustration.height}}" style="height:auto;background-position: center ; background-size: cover; background-image: url(/{{ appAlias }}/uploads/illustration/{{source}}");"> <div id="illustration{{illustration.id}}" class="grid-item grid-item-size {{class}} {{classmini}} cssfilter cssfilter-{{category.id}}" data-width="{{illustration.width}}" data-background-image="/{{ appAlias }}/uploads/illustration/{{source}}" data-height="{{illustration.height}}" style="height:auto;background-position: center ; background-size: cover; background-image: url(/{{ appAlias }}/uploads/illustration/{{source}}");">
</div> </div>
</a> </a>
{% endfor %} {% endfor %}
@ -311,7 +311,7 @@
{% set class=" grid-item-size-2 grid-item-size-page" %} {% set class=" grid-item-size-2 grid-item-size-page" %}
<a href="{{ path("app_webzine_view",{"idcat":webzine.id,"id":page.id,"by":"user"}) }}"> <a href="{{ path("app_webzine_view",{"idcat":webzine.id,"id":page.id,"by":"user"}) }}">
<div id="webzine{{webzine.id}}" class="grid-item grid-item-size {{class}} cssfilter no-cache-bg" data-width="{{page.width}}" data-background-image="/{{ appAlias }}/uploads/webzine/{{source}}" data-height="{{page.height}}" style="height:auto;background-position: center ; background-size: cover; background-image: url(/{{ appAlias }}/uploads/webzine/{{source}}");"> <div id="webzine{{webzine.id}}" class="grid-item grid-item-size {{class}} cssfilter" data-width="{{page.width}}" data-background-image="/{{ appAlias }}/uploads/webzine/{{source}}" data-height="{{page.height}}" style="height:auto;background-position: center ; background-size: cover; background-image: url(/{{ appAlias }}/uploads/webzine/{{source}}");">
</div> </div>
</a> </a>
{% endif %} {% endif %}
@ -400,28 +400,6 @@
{% endblock %} {% endblock %}
{% block localjavascript %} {% 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() { $(document).ready(function() {
$('body').imagesLoaded(function() { $('body').imagesLoaded(function() {
height=Math.max(500,$(window).height()); height=Math.max(500,$(window).height());

View File

@ -57,7 +57,7 @@ ILLUSTRATIONS
{% set height=30*90/21 %} {% set height=30*90/21 %}
{% endif %} {% endif %}
<div style="width:90px; height:{{ height }}px;background-position: center ; background-size: cover; background-image: url(/{{ appAlias }}/uploads/illustration/{{source}}?v={{ random(0, 10000) }}");"> <div style="width:90px; height:{{ height }}px;background-position: center ; background-size: cover; background-image: url(/{{ appAlias }}/uploads/illustration/{{source}}?{{illustration.updatetime|date('ymdHis')}});">
</td> </td>

View File

@ -43,7 +43,7 @@
{% set height=30*90/21 %} {% set height=30*90/21 %}
{% endif %} {% endif %}
<div style="width:90px; height:{{ height }}px;background-position: center ; background-size: cover; background-image: url(/{{ appAlias }}/uploads/illustration/{{source}}?v={{ random(0, 10000) }}");"> <div style="width:90px; height:{{ height }}px;background-position: center ; background-size: cover; background-image: url(/{{ appAlias }}/uploads/illustration/{{source}}?{{illustration.updatetime|date('ymdHis')}});">
</td> </td>
<td>{{ illustration.submittime|date("Y-m-d H:i") }}</td> <td>{{ illustration.submittime|date("Y-m-d H:i") }}</td>