Jump to content

write text in image


neugi

Recommended Posts

Hi,

i want to use this code to write a text to a img, but it din't work and i don't know why.

[code]   
    $font = "rabiohead.ttf";
    $grund_bild = "barcode.gif";
    $winkel = "90";
    $text = "test";

    $img = imagecreatefromgif($grund_bild);
    $black = imagecolorallocate($img, 0,0,0);
    imagettftext($img, 10, $winkel, 0, 0, $black, $font, $text);

    header("Content-type: image/gif");
    imagegif($img);
    imagedestroy($img);[/code]

myabe someone can find the problem.

thx
Link to comment
https://forums.phpfreaks.com/topic/13441-write-text-in-image/
Share on other sites

this is a png version ok and tested

//<?php

//header("Content-type: images/png");
//$string = "hi";
//$im    = imagecreatefrompng("images/banner.png");
//$orange = imagecolorallocate($im, 220, 210, 60);
//$px    = (imagesx($im) - 7.5 * strlen($string)) / 2;
//imagestring($im, 3, $px, 9, $string, $orange);
//imagepng($im);
//imagedestroy($im);

//?>
Link to comment
https://forums.phpfreaks.com/topic/13441-write-text-in-image/#findComment-51940
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.