Forum: PC-Programmierung PHP Text auf bild schreiben funktioniert nicht


von Joel (Gast)


Lesenswert?

Hallo zusammen

Ich habe viel im Internet gesucht und gute Infos über das thema 
gefunden.
Dumm nur das es mir kein Text auf das Bild schreibt.....

Code:
1
    $name = "images/itemicons/" . $json_BotInv[0][4] . ".png";
2
    $image = $json_BotInv[0][2];
3
    $item = imagecreatefrompng($image);
4
5
    $size = 20;
6
    $angle = 0;
7
    $fontfile = 'TTF/segoe-ui-light-arabic.ttf';
8
    $text = "This is a test";
9
    $x = 0;
10
    $y = 0;
11
    $colour = imagecolorallocate($item, 0, 0, 0); //black
12
13
    imagettftext($item, $size, $angle, $x, $y, $colour, $fontfile, $text);
14
15
    // Das Bild als 'simpletext.jpg' speichern
16
    imagepng($item, $name);
17
18
    // Den Speicher freigeben
19
    imagedestroy($item);

Der Link wo das bild herkommt ($json_BotInv[0][2]) ist : 
http://cdn.steamcommunity.com/economy/image/-9a81dlWLwJ2UUGcVs_nsVtzdOEdtWwKGZZLQHTxDZ7I56KU0Zwwo4NUX4oFJZEHLbXH5ApeO4YmlhxYQknCRvCo04DEVlxkKgpotLO_JAlf0v73cjxQ7tO4q4aClfLmDLfYkWNFpsdy3u_D8YnxjgPlqUA-amvxdYSQewBqMAvYrge9kuvvhpa66c6fzHN9-n51aYxySVE

Der link wo es gespeichert ist ($name): 
http://csgotrades.org/images/itemicons/-9a81dlWLwJ2UUGcVs_nsVtzdOEdtWwKGZZLQHTxDZ7I56KU0Zwwo4NUX4oFJZEHLbXH5ApeO4YmlhxYQknCRvCo04DEVlxkKgpotLO_JAlf0v73cjxQ7tO4q4aClfLmDLfYkWNFpsdy3u_D8YnxjgPlqUA-amvxdYSQewBqMAvYrge9kuvvhpa66c6fzHN9-n51aYxySVE.png

Da wo der Font ist:
http://csgotrades.org/TTF/

Also das Bild wird gespeichert aber halt ohne Text....
Schon mal im voraus danke für uere Hilfe

MFG
Joel

von c.m. (Gast)


Lesenswert?

ändere x/y mal in 100/100 falls das bild größer als das ist.
könnte sein das der text mit den koordinaten 0/0 über das bild 
geschrieben wird, also außerhalb.

von Joel (Gast)


Lesenswert?

Danke Vielmals hat Funktioniert!!!!!!!

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.