Question Need a API-Text to Image PHP script

Discussion in 'Linux' started by B1uscr34m, Dec 13, 2016.

  1. B1uscr34m

    B1uscr34m Active Member

    Hey guys, i was thinking of this a lot of times now and most of you seem pretty familiar with PHP and webservers so i decided to explain my request here as good as possible:

    How it should work:
    1. I copy the script template and rewrite it to use the API i need right now ( In this example the github API )
    2. I upload it to my webserver at for example
    3. Anyone can request
    4. It returns the text returned by the api in a white color on the image.
    It would be awesome if someone could point me to it if it already exists :)
  2. Kleberstoff

    Kleberstoff Knowledge Seeker VIP

    So basicly, you want a script that outputs the API's output to a Image and the Image Color can be changed by a get-request?
    Just need confirmation that i understood it correctly.
    B1uscr34m likes this.
  3. Ridicc

    Ridicc Super Mod

    I'm gonna work on it as soon as I'm at home. It's not that hard, do you want it to be a png or a jpg file?
    B1uscr34m and Kleberstoff like this.
  4. B1uscr34m

    B1uscr34m Active Member

    Thanks, i would prefer a png for transparency ♥
  5. dedmen

    dedmen TS3 Dev-Team Contributor

    function makeImageF($text$W=800$fsize=13,$bgr=1,$bgb=1,$bgg=1,$bga=127){
    $H substr_count ($text,"\n") * 20;
    //$H = 50;
    $im imagecreatetruecolor($W$H);
    $background_color imagecolorallocatealpha ($im$bgr,$bgb,$bgg,$bga);        //RGB color background.
    imagefill ($im,0,0,$background_color);
    $text_color imagecolorallocate($im000);
    $i 0;
    putenv('GDFONTPATH=' realpath('.'));
           foreach (
    explode("\n" $text) as $value){
    imagettftext ($im $fsize ,0, ($i 16)+16$text_colordirname(__FILE__) . '/cour.ttf',$value);
    //array imagettftext ( resource $im , int $size , int $angle , int $x , int $y , int $col , string $fontfile , string $text )
               // imagestring($im, 1, 0, $i * 20, $value,$text_color);
    header('Content-type: image/png');//jpeg
    copy pasta from my dynamic teamspeak banner thingy
  6. B1uscr34m

    B1uscr34m Active Member

    Any progress yet? I'm waiting so desperately for this :)
  7. Ridicc

    Ridicc Super Mod

    Kinda forgot it since I'm pretty busy. I'm sorry but it could take quite some time.
    B1uscr34m likes this.

Share This Page