
Recherche avancée
Médias (1)
-
The Great Big Beautiful Tomorrow
28 octobre 2011, par
Mis à jour : Octobre 2011
Langue : English
Type : Texte
Autres articles (49)
-
Les tâches Cron régulières de la ferme
1er décembre 2010, parLa gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
Le super Cron (gestion_mutu_super_cron)
Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...) -
Librairies et binaires spécifiques au traitement vidéo et sonore
31 janvier 2010, parLes logiciels et librairies suivantes sont utilisées par SPIPmotion d’une manière ou d’une autre.
Binaires obligatoires FFMpeg : encodeur principal, permet de transcoder presque tous les types de fichiers vidéo et sonores dans les formats lisibles sur Internet. CF ce tutoriel pour son installation ; Oggz-tools : outils d’inspection de fichiers ogg ; Mediainfo : récupération d’informations depuis la plupart des formats vidéos et sonores ;
Binaires complémentaires et facultatifs flvtool2 : (...) -
Ajouter notes et légendes aux images
7 février 2011, parPour pouvoir ajouter notes et légendes aux images, la première étape est d’installer le plugin "Légendes".
Une fois le plugin activé, vous pouvez le configurer dans l’espace de configuration afin de modifier les droits de création / modification et de suppression des notes. Par défaut seuls les administrateurs du site peuvent ajouter des notes aux images.
Modification lors de l’ajout d’un média
Lors de l’ajout d’un média de type "image" un nouveau bouton apparait au dessus de la prévisualisation (...)
Sur d’autres sites (5198)
-
Perspective transformations
Finally (after a long break) I managed to force myself to update the PHP documentation and this time it was distortImage code example. Things have been hectic lately but that does not quite explain the 6 months(?) break between this and the previous post. As a matter of a fact there is no excuse for such a long silence so I will try to update this blog a bit more often from now on.
Back in the day I used to blog the examples and update the documentation if I remembered but I am trying to fix this bad habit. Most of the latest examples have been updated in to the manual. In the case of the two last examples I updated the documentation first and then blogged on the subject.
I took some time to actually understand the perspective transformations properly using the excellent ImageMagick examples (mainly created by Anthony Thyssen) as a reference. The basic idea of perspective distortion seems simple : to distort the control points to new locations. Grabbing the syntax for Imagick was easy, an array of control point pairs in the form of :
-
array(source_x, source_y, dest_x, dest_y ... )
The following example uses the built-in checkerboard pattern to demonstrate perspective distortion :
-
< ?php
-
/* Create new object */
-
$im = new Imagick() ;
-
-
/* Create new checkerboard pattern */
-
$im->newPseudoImage(100, 100, "pattern:checkerboard") ;
-
-
/* Set the image format to png */
-
$im->setImageFormat(’png’) ;
-
-
/* Fill background area with transparent */
-
$im->setImageVirtualPixelMethod(Imagick: :VIRTUALPIXELMETHOD_TRANSPARENT) ;
-
-
/* Activate matte */
-
$im->setImageMatte(true) ;
-
-
/* Control points for the distortion */
-
$controlPoints = array( 10, 10,
-
10, 5,
-
-
10, $im->getImageHeight() - 20,
-
10, $im->getImageHeight() - 5,
-
-
$im->getImageWidth() - 10, 10,
-
$im->getImageWidth() - 10, 20,
-
-
$im->getImageWidth() - 10, $im->getImageHeight() - 10,
-
$im->getImageWidth() - 10, $im->getImageHeight() - 30) ;
-
-
/* Perform the distortion */
-
$im->distortImage(Imagick: :DISTORTION_PERSPECTIVE, $controlPoints, true) ;
-
-
/* Ouput the image */
-
header("Content-Type : image/png") ;
-
echo $im ;
-
?>
Here is the source image :
And the result :
-
-
Perspective transformations
Finally (after a long break) I managed to force myself to update the PHP documentation and this time it was distortImage code example. Things have been hectic lately but that does not quite explain the 6 months(?) break between this and the previous post. As a matter of a fact there is no excuse for such a long silence so I will try to update this blog a bit more often from now on.
Back in the day I used to blog the examples and update the documentation if I remembered but I am trying to fix this bad habit. Most of the latest examples have been updated in to the manual. In the case of the two last examples I updated the documentation first and then blogged on the subject.
I took some time to actually understand the perspective transformations properly using the excellent ImageMagick examples (mainly created by Anthony Thyssen) as a reference. The basic idea of perspective distortion seems simple : to distort the control points to new locations. Grabbing the syntax for Imagick was easy, an array of control point pairs in the form of :
-
array(source_x, source_y, dest_x, dest_y ... )
The following example uses the built-in checkerboard pattern to demonstrate perspective distortion :
-
< ?php
-
/* Create new object */
-
$im = new Imagick() ;
-
-
/* Create new checkerboard pattern */
-
$im->newPseudoImage(100, 100, "pattern:checkerboard") ;
-
-
/* Set the image format to png */
-
$im->setImageFormat(’png’) ;
-
-
/* Fill background area with transparent */
-
$im->setImageVirtualPixelMethod(Imagick: :VIRTUALPIXELMETHOD_TRANSPARENT) ;
-
-
/* Activate matte */
-
$im->setImageMatte(true) ;
-
-
/* Control points for the distortion */
-
$controlPoints = array( 10, 10,
-
10, 5,
-
-
10, $im->getImageHeight() - 20,
-
10, $im->getImageHeight() - 5,
-
-
$im->getImageWidth() - 10, 10,
-
$im->getImageWidth() - 10, 20,
-
-
$im->getImageWidth() - 10, $im->getImageHeight() - 10,
-
$im->getImageWidth() - 10, $im->getImageHeight() - 30) ;
-
-
/* Perform the distortion */
-
$im->distortImage(Imagick: :DISTORTION_PERSPECTIVE, $controlPoints, true) ;
-
-
/* Ouput the image */
-
header("Content-Type : image/png") ;
-
echo $im ;
-
?>
Here is the source image :
And the result :
-
-
Anomalie #4623 : Styles des fieldset dans l’espace privé
18 avril 2021Bon stop (ou pas) !
Il semble que les blocs
fieldset
ne peuvent pas parfaitement se styler seuls. Manifestement c’est assez récent que les navigateurs acceptent undisplay:flex;
dessus par exemple.J’ai fait quelques tests en partant du formulaire de préférences des menus (tiens d’ailleurs ce formulaire a des
div.editer
sansdiv.editer-groupe
parent (à corriger !)
Il contient unfieldset + .editer-groupe.deux_colonnes
(columns : 2)Ce que j’ai testé (sous macOS avec FF, Safari, Chrome & Opéra) : la formule suivante (enlever le .editer-groupe interne et le monter sur le fieldset)
- <span class="CodeRay"><span class="tag">fieldset</span><span class="class">.editer-groupe</span>
- <span class="tag">legend</span>
- <span class="tag">div</span><span class="class">.editer</span>
- <span class="tag">div</span><span class="class">.editer</span>
- ...
- </span>
1) Si on applique un
columns: 2
sur ce fieldset,
- Firefox & Safari : conservent le legend, passent le reste en 2 colonnes
- Chrome & Opéra : ignorent et conservent donc un affichage 1 colonne.2) Si on applique un
display: flex; flex-wrap: wrap
sur ce fieldset
- Tous : le legend est conservé comme tel
- le reste passe effectivement en flex (permettant donc de mettre plusieurs .editer sur la même ligne)Déjà je suis étonné que Flex semble fonctionner, contrairement à ce que dit https://caniuse.com/mdn-html_elements_fieldset pour tous les Gecko. Et Edge aussi est indiqué en non fonctionnel.
Donc du coup… je me dis que le .editer-groupe dans le fieldset à encore du sens stylistique.
Ce qui pour le coup ne nous arrange pas forcément, mais ça évite aussi de casser un truc de plus dans cette structure html en le laissant.Donc du coup, on en reviendrait peut être à "fieldset.editer-section" ou "fieldset.editer-fieldset" ou "fieldset.fieldset" ou "fieldset" (sans rien)…
J’utilise .editer-section ensuite (mais peut importe)A) fieldset.editer-section > div.editer-groupe¶
(le plus proche de l’actuel je pense)
- <span class="CodeRay"> <span class="tag">div</span><span class="class">.editer-groupe</span>
- <span class="tag">div</span><span class="class">.editer</span>
- ...
- <span class="tag">fieldset</span><span class="class">.editer-section</span>
- <span class="tag">legend</span>
- <span class="tag">div</span><span class="class">.editer-groupe</span>
- <span class="tag">div</span><span class="class">.editer</span>
- ...
- </span>
B) fieldset.editer-groupe > div.editer-section¶
L’autre possibilité si ça facilite vraiment le css, c’est d’inverser les classes (avec l’ennui principal de du coup devoir reprendre l’existant)
- <span class="CodeRay"> <span class="tag">div</span><span class="class">.editer-groupe</span>
- <span class="tag">div</span><span class="class">.editer</span>
- ...
- <span class="tag">fieldset</span><span class="class">.editer-groupe</span>
- <span class="tag">legend</span>
- <span class="tag">div</span><span class="class">.editer-fieldset</span>
- <span class="tag">div</span><span class="class">.editer</span>
- ...
- </span>
B) fieldset.editer-groupe.editer-section > div.editer-groupe¶
Ou du doubler d’une autre classe
- <span class="CodeRay"> <span class="tag">div</span><span class="class">.editer-groupe</span>
- <span class="tag">div</span><span class="class">.editer</span>
- ...
- <span class="tag">fieldset</span><span class="class">.editer-groupe</span><span class="class">.editer-section</span>
- <span class="tag">legend</span>
- <span class="tag">div</span><span class="class">.editer-groupe</span>
- <span class="tag">div</span><span class="class">.editer</span>
- ...
- </span>
Mais dans ce cas là je trouve cela redondant (fieldset.editer-section me parait suffisant, si on doit effectivement mettre un classe css dessus)
Le plus ennuyant est peut être de devoir annuler des styles CSS du .editer-groupe dans .editer-section > .editer-groupe ;