Jump to content

Problem with imagefttext


Dubcanada

Recommended Posts

Hello,

 

I am trying to create a signature generator and I've got all of it done but the actual genetator part. Here is the problem. I have about 40 gifs (240x20) that I want to right username, and stats onto using imagefttext. I want to use the color white or another color choosen by them. I have everything showing up fine, and it all looks fine EXCEPT the text color is different on every single image and it is only white on one.

 

honlabs.com/SignatureBar/sig.php for example, it's orange. Now if I change the image to honlabs.com/SignatureBar/bgs/chronos.gif it will be white. But if I change it to honlabs.com/SignatureBar/bgs/madman.gif it will be redish gray. Basically the color of the little icon. How do I make it white on ALL images?

 

Also, how could I remove AA from imagefttext. If I make it small enough it doesn't show anything but I don't want it to be size 7.

 

- Steve

Link to comment
https://forums.phpfreaks.com/topic/168057-problem-with-imagefttext/
Share on other sites

<?php

 

  // show the correct header for the image type

  header("Content-type: image/gif");

 

  // an email address in a string

  $string = "Dub";

  $string2 = "W 21 L 32    K 122 D 3 A 32";

 

  // lets begin by creating an image

  $im = imagecreatefromgif("bgs/blacksmith.gif");

  $w = imagecolorallocate($im, 255,255,255);

    // some variables to set

  $font  = "fonts/pf_tempesta_seven_condensed.ttf";

  $font2  = "fonts/pf_tempesta_seven_condensed_bold.ttf";

  imagettftext($im, "6", "0", "60", "16", $w, $font2, $string);

  imagettftext($im, "6", "0", "90", "16", $w, $font, $string2);

 

  // and display

  imagegif ($im);

?>

k, i got it to work... instead of creating from gif, i use "imagecreatetruecolor" to create a container, and i also create an image resource of your gif ... then copied them together...

 

here is the code if interested, figure i would just post it rather then explain it... but see if it works for you... Oh, and change the image and font paths first....

 

  header("Content-type: image/gif");

  // an email address in a string
  $string = "Dub";
  $string2 = "W 21 L 32    K 122 D 3 A 32";

  // lets begin by creating an image
  
  $container = imagecreatetruecolor(240, 25);
  $im = imagecreatefromgif("dubcanada/blacksmith.gif");
  imagecopy($container, $im, 0, 0, 0, 0, 240, 25);
  
  $w = imagecolorallocate($container, 255,255,255);
    // some variables to set
  $font  = "dubcanada/pf_tempesta_seven_condensed.ttf";
  $font2  = "dubcanada/pf_tempesta_seven_condensed_bold.ttf";
  imagettftext($container, "8", "0", "60", "16", $w, $font2, $string);
  imagettftext($container, "8", "0", "90", "16", $w, $font, $string2);

  // and display
  imagegif ($container);

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.