imagecharup
<<<
imagecolorallocate imagecolorallocatealpha
>>>

6.14 Images
6 Référence des fonctions
 Manuel PHP

Introduction
Pré-requis
Installation
Configuration à l'exécution
Types de ressources
Constantes pré-définies
Exemples
gd_info
getimagesize
image_type_to_extension
image_type_to_mime_type
image2wbmp
imagealphablending
imageantialias
imagearc
imagechar
imagecharup
->imagecolorallocate
imagecolorallocatealpha
imagecolorat
imagecolorclosest
imagecolorclosestalpha
imagecolorclosesthwb
imagecolordeallocate
imagecolorexact
imagecolorexactalpha
imagecolormatch
imagecolorresolve
imagecolorresolvealpha
imagecolorset
imagecolorsforindex
imagecolorstotal
imagecolortransparent
imageconvolution
imagecopy
imagecopymerge
imagecopymergegray
imagecopyresampled
imagecopyresized
imagecreate
imagecreatefromgd
imagecreatefromgd2
imagecreatefromgd2part
imagecreatefromgif
imagecreatefromjpeg
imagecreatefrompng
imagecreatefromstring
imagecreatefromwbmp
imagecreatefromxbm
imagecreatefromxpm
imagecreatetruecolor
imagedashedline
imagedestroy
imageellipse
imagefill
imagefilledarc
imagefilledellipse
imagefilledpolygon
imagefilledrectangle
imagefilltoborder
imagefilter
imagefontheight
imagefontwidth
imageftbbox
imagefttext
imagegammacorrect
imagegd
imagegd2
imagegif
imageinterlace
imageistruecolor
imagejpeg
imagelayereffect
imageline
imageloadfont
imagepalettecopy
imagepng
imagepolygon
imagepsbbox
imagepscopyfont
imagepsencodefont
imagepsextendfont
imagepsfreefont
imagepsloadfont
imagepsslantfont
imagepstext
imagerectangle
imagerotate
imagesavealpha
imagesetbrush
imagesetpixel
imagesetstyle
imagesetthickness
imagesettile
imagestring
imagestringup
imagesx
imagesy
imagetruecolortopalette
imagettfbbox
imagettftext
imagetypes
imagewbmp
imagexbm
iptcembed
iptcparse
jpeg2wbmp
png2wbmp

6.14.18 imagecolorallocate()Alloue une couleur pour une image

[ Exemples avec imagecolorallocate ]   PHP 3, PHP 4, PHP 5

int  imagecolorallocate ( resource   image , int   red , int   green , int   blue )

imagecolorallocate retourne un identifiant de couleur, représentant la couleur composée avec les couleurs RGB ( red , green , blue ). L'argument image est le résultat de la fonction imagecreatetruecolor . Les paramètres red , green et blue sont les valeurs respectives des composants rouge, vert et bleue de la couleur voulue. Ces paramètres sont des entiers compris entre 0 et 255 ou des hexadécimaux compris entre 0x00 and 0xFF. imagecolorallocate doit être appelée pour créer chaque couleur qui sera représentée par image .

Note

Le premier appel à imagecolorallocate remplie la couleur de fond.

Exemple avec imagecolorallocate

<?php

$im
= imagecreatetruecolor('example.jpg');
// Le fond de l'image est en rouge
$background = imagecolorallocate($im, 255, 0, 0);

// On définit des couleurs avec des entiers ..
$white = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);

// .. ou des hexadécimaux
$white = imagecolorallocate($im, 0xFF, 0xFF, 0xFF);
$black = imagecolorallocate($im, 0x00, 0x00, 0x00);

?>

imagecolorallocate retourne -1 si l'allocation échoue.

Voir aussi imagecolorallocatealpha et imagecolordeallocate .

<< imagecolorallocate >>
imagecharup Images imagecolorallocatealpha