From ee0899a9dc299e04ecb378cd49a1bd13b98ec14e Mon Sep 17 00:00:00 2001 From: tofulm Date: Fri, 5 Mar 2021 16:31:20 +0100 Subject: [PATCH 1/5] =?UTF-8?q?Gros=20bug=20=C3=A0=20l'installation,=20le?= =?UTF-8?q?=20champ=20protected=20n'etait=20pas=20cree?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bigform_administrations.php | 4 +++- paquet.xml | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/bigform_administrations.php b/bigform_administrations.php index 6341f9b..41b3531 100644 --- a/bigform_administrations.php +++ b/bigform_administrations.php @@ -31,7 +31,9 @@ function bigform_upgrade($nom_meta_base_version, $version_cible) { 'charger_public' => 1 ]; - $maj['create'] = [['ecrire_meta', 'bigup', serialize($config_defaut)]]; + $maj['create'] = [ + ['maj_tables', ['spip_documents']], + ['ecrire_meta', 'bigup', serialize($config_defaut)]]; $maj['1.0.1'] = [['ecrire_meta', 'bigup', serialize($config_defaut)]]; $maj['1.0.4'] = [['maj_tables', ['spip_documents']]]; diff --git a/paquet.xml b/paquet.xml index 28f5f2a..9db86a3 100644 --- a/paquet.xml +++ b/paquet.xml @@ -1,7 +1,7 @@ Date: Fri, 5 Mar 2021 16:46:48 +0100 Subject: [PATCH 2/5] amelioration documentation sur les doc protected --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 705db52..6e64760 100644 --- a/README.md +++ b/README.md @@ -51,3 +51,6 @@ $bigform($id_objet, $objet, $mode, true); ``` > **ATTENTION** > Il faut ajouter les vérifications pour les différents types de fichiers + +> **ATTENTION pour les documents protégés** +> Il faut activer les urls propres : URLs Propres+.html From a8f439967ed1eeafad4489c505646e4b58e4d582 Mon Sep 17 00:00:00 2001 From: tofulm Date: Tue, 9 Mar 2021 18:37:41 +0100 Subject: [PATCH 3/5] si c'est une image png / jpg / webm, prepare le cache image --- bigform_pipelines.php | 32 ++++++++++++++++++++++++++++++++ paquet.xml | 2 ++ retailler_img.html | 8 ++++++++ 3 files changed, 42 insertions(+) create mode 100644 retailler_img.html diff --git a/bigform_pipelines.php b/bigform_pipelines.php index 9c9f23c..7d87890 100644 --- a/bigform_pipelines.php +++ b/bigform_pipelines.php @@ -12,3 +12,35 @@ if (!defined('_ECRIRE_INC_VERSION')) { return; } + +/** + * Branchement sur l'insertion de document pour generer le cache des images + * a la sortie du formualire + * Extensions utilisées : + * - jpg + * - png + * - webm + * + * @param Array $flux + * + * @return Array $flux + */ +function bigform_post_edition($flux){ + if ( + $flux['args']['table'] === 'spip_documents' + and $id_document = intval($flux['args']['id_objet']) + and $flux['args']['action'] === 'ajouter_document' + and in_array($flux['data']['extension'], ['jpg', 'png', 'webm']) + ) { + $url = generer_url_public("retailler_img", [ + "id_document" =>intval($id_document), + "hash" => md5(date("Y-m-d")) + ], true, false); + + $ch = curl_init($url); + curl_exec($ch); + curl_close($ch); + } + + return $flux; +} diff --git a/paquet.xml b/paquet.xml index 9db86a3..4812f3e 100644 --- a/paquet.xml +++ b/paquet.xml @@ -21,5 +21,7 @@ + + diff --git a/retailler_img.html b/retailler_img.html new file mode 100644 index 0000000..1186fa9 --- /dev/null +++ b/retailler_img.html @@ -0,0 +1,8 @@ +#CACHE{0} + + + [(#FICHIER|image_recadre{3072:1800,-,focus}|adaptive_images{3072})] + [(#FICHIER|image_recadre{2048:1200,-,focus}|adaptive_images{2048})] + [(#FICHIER|image_recadre{1024:600,-,focus}|adaptive_images{1024})] + [(#FICHIER|image_recadre{512:300,-,focus}|adaptive_images{512})] + From 5d21b9b8f321980dd6c7fbf01556c86aacc19f55 Mon Sep 17 00:00:00 2001 From: tofulm Date: Tue, 9 Mar 2021 18:50:25 +0100 Subject: [PATCH 4/5] ajout une option de config pour activer le retaillage des images --- bigform_pipelines.php | 1 + formulaires/configurer_bigform.html | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/bigform_pipelines.php b/bigform_pipelines.php index 7d87890..a7211f8 100644 --- a/bigform_pipelines.php +++ b/bigform_pipelines.php @@ -31,6 +31,7 @@ function bigform_post_edition($flux){ and $id_document = intval($flux['args']['id_objet']) and $flux['args']['action'] === 'ajouter_document' and in_array($flux['data']['extension'], ['jpg', 'png', 'webm']) + and lire_config('bigform/retailler_image') === 'oui' ) { $url = generer_url_public("retailler_img", [ "id_document" =>intval($id_document), diff --git a/formulaires/configurer_bigform.html b/formulaires/configurer_bigform.html index 9170cb7..615c84e 100644 --- a/formulaires/configurer_bigform.html +++ b/formulaires/configurer_bigform.html @@ -9,6 +9,22 @@
#ACTION_FORMULAIRE +
+ #SET{name,retailler_image} + #SET{erreurs,#ENV**{erreurs}|table_valeur{#GET{name}}} +
+ +
+ + +
+
+ + +
+
+
+

 

From 4138f71680ed80455d0b6e29c014ec3e506d738d Mon Sep 17 00:00:00 2001 From: tofulm Date: Tue, 9 Mar 2021 19:03:24 +0100 Subject: [PATCH 5/5] on supprime le hash, on le remplace par 3 criteres hauteur / largeur / taille up de z --- bigform_pipelines.php | 4 +++- paquet.xml | 2 +- retailler_img.html | 4 +--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bigform_pipelines.php b/bigform_pipelines.php index a7211f8..c69d2aa 100644 --- a/bigform_pipelines.php +++ b/bigform_pipelines.php @@ -35,7 +35,9 @@ function bigform_post_edition($flux){ ) { $url = generer_url_public("retailler_img", [ "id_document" =>intval($id_document), - "hash" => md5(date("Y-m-d")) + "largeur" => $flux['data']['largeur'], + "hauteur" => $flux['data']['hauteur'], + "taille" => $flux['data']['taille'], ], true, false); $ch = curl_init($url); diff --git a/paquet.xml b/paquet.xml index 4812f3e..ac2b736 100644 --- a/paquet.xml +++ b/paquet.xml @@ -1,7 +1,7 @@ + [(#FICHIER|image_recadre{3072:1800,-,focus}|adaptive_images{3072})] [(#FICHIER|image_recadre{2048:1200,-,focus}|adaptive_images{2048})] [(#FICHIER|image_recadre{1024:600,-,focus}|adaptive_images{1024})]