<?
$resim = imagecreatetruecolor(400,400);
$renk1 = imagecolorallocate($resim,222,222,222);
$renk2 = imagecolorallocate($resim,111,111,111);
$renk3 = imagecolorallocate($resim,123,123,123);
$yazi = "Merhaba Dunyalilar";
$x =strlen($yazi);
for($a=1;$a<=$x;$a++){
imagecharup($resim,10,20,20*$a,$yazi,$renk2);
$yazi = substr($yazi,1);
}
imagejpeg($resim);
imagedestroy($resim);
?>
imagecharup
(PHP 4, PHP 5)
imagecharup — Dessine un caractère verticalement
Description
Dessine le premier caractère de la chaîne c verticalement dans l'image image fournie.
Liste de paramètres
- image
-
Une ressource d'image, retourné par une des fonctions de création d'images, comme imagecreatetruecolor().
- font
-
Peut être 1, 2, 3, 4, 5 pour les polices internes d'encodage Latin2 (où les plus grands nombres correspondent aux polices larges) ou n'importe quels identifiants de police de votre choix, enregistrées avec la fonction imageloadfont().
- x
-
X : coordonnée de départ
- y
-
Y : coordonnée de départ
- c
-
Le caractère à dessiner
- color
-
Un identifiant de couleur, créé avec la fonction imagecolorallocate()
Valeurs de retour
Cette fonction retourne TRUE en cas de succès, FALSE en cas d'échec.
Exemples
Exemple #1 Exemple avec imagecharup()
<?php
$im = imagecreate(100, 100);
$string = 'Notez que la première lettre est un N';
$bg = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);
// affiche un "Z" noir sur un fond blanc
imagecharup($im, 3, 10, 10, $string, $black);
header('Content-type: image/png');
imagepng($im);
?>
L'exemple ci-dessus va afficher quelque chose de similaire à :
imagecharup
26-Feb-2006 02:33
02-Dec-2005 10:18
I'm using imagestringup() function to write text upwards.
16-Jun-2005 04:28
<?php
// incredibly, no one has added this.
// write a string of text vertically on an image..
// ;o)
$string = '(c) corz.org';
$font_size = 2;
$img = imagecreate(20,90);
$bg = imagecolorallocate($img,225,225,225);
$black = imagecolorallocate($img,0,0,0);
$len = strlen($string);
for ($i=1; $i<=$len; $i++) {
imagecharup($img, $font_size, 5, imagesy($img)-($i*imagefontwidth($font_size)), $string, $black);
$string = substr($string,1);
}
header('Content-type: image/png');
imagepng($img);
imagedestroy($img); // dudes! don't forget this!
?>
