PHP:
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
| <? // header("Content-type: image/jpeg"); // // get src image and dimensions $src_img = ImageCreateFromJPEG("test.jpg"); $src_w = ImageSX($src_img); $src_h = ImageSY($src_img); // // create empty true color canvas, def bg is black $txt_img = ImageCreateTrueColor($src_w,$src_h); // // define colors $white = ImageColorAllocate ($txt_img, 255, 255, 255); $black = ImageColorAllocate ($txt_img, 0, 0, 0); // // add your white text imagettftext ($txt_img, 80, 25, 65, 350, $white, "./picstore2/times.ttf", "Testing...Omega: Ω"); // ImageTTFText ($txt_img, 80, 25, 65, 350, $white, "times.ttf", "Kung Fu") or die("hallo"); // // make black bg transparent ImageColorTransparent($txt_img, $black); // // merge text image onto src image ImageCopyMerge($src_img,$txt_img,0,0,0,0,$src_w,$src_h,30); // 30% opacity // // create empty true color canvas for resizing. $dst_img = ImageCreateTrueColor(100,100); // // resize ImageCopyResampled($dst_img,$src_img,0,0,0,0,100,100,$src_w,$src_h); // // output to browser. ImageJPEG($dst_img,'',70); // quality 70 ?> |
ik krijg dus de melding dat het font niet geopend of gevonden kan worden?... is er een manier om toch een text op een plaatje te krijgen? met gd/php?