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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.