shadows in gd image

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    shadows in gd image

    im trying to add a shadow to my image generator it generates png transparent bg by telling it font color, font size and text.

    i dunno how to add shadow to the image



    Added after 56 minutes:

    just realised it may help if i post my code

    PHP Code:
    <?php
    header
    ("Content-type: image/png"); //Picture Format 
    header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 
    header("Pragma: no-cache"); // NO CACHE 
    $size imagettfbbox($_GET['size'], 0$font,$_GET['text']);
    $bg imagecreatetruecolor($xsize$ysize); //create Image of size 350px x 75px 
    imagesavealpha($bgtrue); //This will make it transparent 
    $trans_colour imagecolorallocatealpha($bg000127); 
    imagefill($bg00$trans_colour); 
    $color ImageColorAllocate($bg,$r_txt,$g_txt,$b_txt);
    imagettftext($bg$_GET['size'], 0abs($size[0]), abs($size[5]), $color$font$_GET['text']); //Writes text to the image using fonts using FreeType 2 
    imagepng($bg); //Create image 
    ImageDestroy($bg); //destroy image 
    ?>
    Last edited by ori; 25.12.10, 12:12.

    #2
    you may use ImageMagick it wil more easier fr u to achieve the same
    Last edited by Anshul; 26.12.10, 04:20.

    Comment


      #3
      i tried to use your code...
      and suddenly this message appear..

      The image “http://localhost/image.php” cannot be displayed, because it contains errors.

      hehe..

      Comment


        #4
        i know i wasnt gonna give away my code lol... it has bits missing but u can access the file here: wapdesire.com/img.php?color=ff0000&text=test&size=50

        Originally posted by Anshul View Post
        you may use ImageMagick it wil more easier fr u to achieve the same
        i would if i knew it theres no point trying to use something i know nothing about...

        Comment


          #5
          problem fixed the solution was quite easy

          PHP Code:
          $black imagecolorallocate($bg0,0,0);
          $color ImageColorAllocate($bg,$r_txt,$g_txt,$b_txt);
          $xoffset abs($size[0])/8;
          $yoffset abs($size[5])/8;
          imagettftext($bg$_GET['size'], 0abs($size[0])+$xoffsetabs($size[5])+$yoffset$black$font$_GET['text']); //Writes text to the image using fonts using FreeType 2 
          imagettftext($bg$_GET['size'], 0abs($size[0]), abs($size[5]), $color$font$_GET['text']); //Writes text to the image using fonts using FreeType 2 
          imagepng($bg); //Create image 
          ImageDestroy($bg); //destroy image 

          Comment


            #6
            well u can check its official site ImageMagick v6 Examples
            or
            PHP: ImageMagick - Manual

            Comment


              #7
              ok thanks ill have a look

              Comment

              Working...
              X