1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
$image_a_mesurer = "DSC_0065.JPG";
$size = getimagesize($image_a_mesurer);
$width = $size[0]; //X 800
$height = $size[1]; //Y 500
$image_a_mesurer = ImageCreateFromJpeg($image_a_mesurer);
$texte_a_ecrire = "CopyRight 2009";
$police = "arial.ttf";
$text_color = "#FFFFFF";
$color = sscanf($text_color, '#%2x%2x%2x');
$color_r = $color[0];
$color_g = $color[1];
$color_b = $color[2];
$text_color = imagecolorallocate($image_a_mesurer, $color_r, $color_g, $color_b);
$angle = 50;
$pasY = $pasX = 10;
for($i=0; $i < $height; $i++) {
for($j=0; $j < $width; $j++) {
imagettftext($image_a_mesurer, '10',
$angle, // angle
$pasY, // left inset
$pasX, // top inset
$black, $police , $texte_a_ecrire);
$pasX = $pasX + 50;
}
$pasY = $pasY + 50;
}
header("Content-type: image/jpeg");
$res = ImageJPEG($image_a_mesurer,null,'100'); |
Partager