Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Senior Coder NancyJ's Avatar
    Join Date
    Feb 2005
    Location
    Bradford, UK
    Posts
    3,174
    Thanks
    19
    Thanked 66 Times in 65 Posts

    imagegettftext transparent holes

    I created an image, made it transparent, drew a rounded rectangle on it and then wrote on it with imagegettftext - where the text is there are transparent holes.


    PHP Code:
    $image imageCreateTrueColor($width,$height);
    imageSaveAlpha($imagetrue);
    ImageAlphaBlending($imagefalse);

    $transparentColor imagecolorallocatealpha($image255-$r255-$g255-$b127);
    imagefill($image00$transparentColor);

    $background imagecolorallocate($image$br$bg$bb);


    $textColor imagecolorallocate($image$r$g$b);

    ImageRectangleWithRoundedCorners($image2,2,$width-2,$height-2,$radius-2,$background);
    imagettftext($image$fontSize0$radius+4$height-25$textColor$font$text);

    function 
    ImageRectangleWithRoundedCorners(&$im$x1$y1$x2$y2$radius$color) {
    // draw rectangle without corners
    imagefilledrectangle($im$x1+$radius$y1$x2-$radius$y2$color);
    imagefilledrectangle($im$x1$y1+$radius$x2$y2-$radius$color);
    // draw circled corners
    imagefilledellipse($im$x1+$radius$y1+$radius$radius*2$radius*2$color);
    imagefilledellipse($im$x2-$radius$y1+$radius$radius*2$radius*2$color);
    imagefilledellipse($im$x1+$radius$y2-$radius$radius*2$radius*2$color);
    imagefilledellipse($im$x2-$radius$y2-$radius$radius*2$radius*2$color);

    exmaple here:
    http://simstressgames.com/db.php?siz...Essai&text=buy

  • #2
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,538
    Thanks
    8
    Thanked 1,093 Times in 1,084 Posts
    Nancy ...

    I didn't have time to actually experiment with your code,
    but I found this:
    http://jmhoule314.blogspot.com/2006/...-today-im.html

    They are able to put the text without holes.

    Look for some other captcha scripts.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •