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})] +