
Recherche avancée
Autres articles (107)
-
L’agrémenter visuellement
10 avril 2011MediaSPIP est basé sur un système de thèmes et de squelettes. Les squelettes définissent le placement des informations dans la page, définissant un usage spécifique de la plateforme, et les thèmes l’habillage graphique général.
Chacun peut proposer un nouveau thème graphique ou un squelette et le mettre à disposition de la communauté. -
Publier sur MédiaSpip
13 juin 2013Puis-je poster des contenus à partir d’une tablette Ipad ?
Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir -
Ajouter des informations spécifiques aux utilisateurs et autres modifications de comportement liées aux auteurs
12 avril 2011, parLa manière la plus simple d’ajouter des informations aux auteurs est d’installer le plugin Inscription3. Il permet également de modifier certains comportements liés aux utilisateurs (référez-vous à sa documentation pour plus d’informations).
Il est également possible d’ajouter des champs aux auteurs en installant les plugins champs extras 2 et Interface pour champs extras.
Sur d’autres sites (5409)
-
Padding thumbnail with color
I know, it’s been a while since I last blogged. This is because a lot of things are happening in my personal life. I recently relocated to London from Finland and started a new job. Things are quite busy but I will try to post an example now and then. In the meanwhile I would like to hear about sites using Imagick, so if your project is not super secret please post an url and maybe a small explanation what you’re doing with Imagick on the site. This is purely for my personal interest.
Anyway, to the point. Today’s example originates from a question asked by a user. How do I thumbnail the image inside given dimensions proportionally and fill the “blank” areas with a color ? Well, the answer is here
The code is for Imagick 2.1.0 but adapting to older versions should not be hard.
-
< ?php
-
/* Define width and height of the thumbnail */
-
$width = 100 ;
-
$height = 100 ;
-
-
/* Instanciate and read the image in */
-
$im = new Imagick( "test.png" ) ;
-
-
/* Fit the image into $width x $height box
-
The third parameter fits the image into a "bounding box" */
-
$im->thumbnailImage( $width, $height, true ) ;
-
-
/* Create a canvas with the desired color */
-
$canvas = new Imagick() ;
-
$canvas->newImage( $width, $height, ’pink’, ’png’ ) ;
-
-
/* Get the image geometry */
-
$geometry = $im->getImageGeometry() ;
-
-
/* The overlay x and y coordinates */
-
$x = ( $width - $geometry[’width’] ) / 2 ;
-
$y = ( $height - $geometry[’height’] ) / 2 ;
-
-
/* Composite on the canvas */
-
$canvas->compositeImage( $im, imagick: :COMPOSITE_OVER, $x, $y ) ;
-
-
/* Output the image*/
-
header( "Content-Type : image/png" ) ;
-
echo $canvas ;
-
-
?>
-
-
Typesetting
Ever had the situation where you have a piece of string which you need to overlay on an image ? Maybe a situation where the area reserved for the string is known in pixels but you need to know the font size to fill most of the area ? Think no more !
Here is a small example of how to fit a certain piece of a string on to an area of which you know the width and the height or only the width. The magic happens through the ImageMagick CAPTION : format. You can see from the example images how the parameters actually affect the image.
-
< ?php
-
-
/* How wide is our image */
-
$image_width = 200 ;
-
-
/* Give zero for autocalculating the height */
-
$image_height = 200 ;
-
-
/* Specify the text */
-
$text = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
-
Mauris lectus mi, mattis non, euismod vel, sagittis nec, ipsum." ;
-
-
/* Instanciate imagick */
-
$im = new Imagick() ;
-
-
/* Create new image using caption : pseudo format */
-
$im->newPseudoImage( $image_width, $image_height, "caption :" . $text ) ;
-
-
/* Put 1px border around the image */
-
$im->borderImage( ’black’, 1, 1 ) ;
-
-
/* PNG format */
-
$im->setImageFormat( "png") ;
-
-
/* Output */
-
header( "Content-Type : image/png" ) ;
-
echo $im ;
-
-
?>
Here is image with width 100 and height 0 :
Width 100 Height 50 :
Width 200 Height 200 (as you can see the font size is now larger) :
-
-
Revision 31962 : On ne voit les boutons d’actions que lorsqu’on a la souris sur une entrée. ...
7 octobre 2009, par rastapopoulos@… — LogOn ne voit les boutons d’actions que lorsqu’on a la souris sur une entrée. L’interface est donc beaucoup plus lisible.