Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

imagecopymerge question

Status
Not open for further replies.

kasuals

Programmer
Apr 28, 2002
100
US
For some reason before I upgraded this worked:

$bgfile = "bg".mt_rand(1, 10).".jpg";
$im = imagecreatefromjpeg($bgfile);
$im_w = imagesx($im);
$im_h = imagesy($im);

/* Layer 1 - TTF word. */
$new = imagecreatetruecolor($im_w,$im_h);
$color = imagecolorallocate($im, 0, 0, 0);
$textbb = imagettfbbox(40, 0, "c:\windows\fonts\arial.ttf", $curline);
$temp_w = mt_rand(1, ($im_w - $textbb[2]));
$temp_h = mt_rand(-$textbb[5], ($im_h - $textbb[3]));
imagettftext($new, 40, 0, $temp_w, $temp_h, $color, "c:\windows\fonts\arial.ttf", $curline);
imagecopymerge($im, $new, 0, 0, 0, 0, $im_w, $im_h, 30);
imagedestroy($new);

It took a background image and then placed text overi t. Now for some reason if the transparency on imagecopymerge is less than 100% it seems to make the whole thing darker... this wasn't the case before... So I have it at 30 now, and the text should just have an opacity of 30, but for some reason the whole thing gets dark.

Any ideas?

- "Delightfully confusing..." raves The New York Times

-kas
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top