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
$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