用PHP将图像放置在另一个图像中
|
我有一个图像,该文本通过php表单动态生成。我将徽标图像的位置保存到mysql数据库的变量中。是否可以拍摄此图像并将其应用于图像中的固定位置?如果需要,必须将其调整为较小尺寸以适合此图像区域。
我已经有一个脚本,如下所示:
$img = imagecreatefromjpeg(\'coupon/coupontemplate.jpg\');
$textColor = imagecolorallocate($img, 0, 0, 0); // black text
//Write first the coupon title
imagefttext($img, 16, 0, 20, 34, $textColor, \'coupon/arialbd.ttf\', $title);
//Then write the coupon description
imagettftextbox($img, 13, 0, 20, 45, $textColor, \'coupon/arial.ttf\', $description, 440);
//If the checkbox to include logo is checked...
if ($_POST[\'clogo\'] == \'y\') {
$logo = $row[\'imagecompany\'];
$logo_file = \"../directory/memberimages/$logo\";
$logo_file_type = getimagesize($logo_file);
if ($logo_file_type[\'mime\'] == \'image/jpg\') {
$logoImage = imagecreatefromjpeg($logo_file);
} else if ($logo_file_type[\'mime\'] == \'image/gif\') {
$logoImage = imagecreatefromgif($logo_file);
} else if ($logo_file_type[\'mime\'] == \'image/png\') {
$logoImage = imagecreatefrompng($logo_file);
}
}
// Output image to the browser
//header(\'Content-Type: image/jpeg\');
//imagejpeg($img);
// Or save to file
imagejpeg($img, \'my-text.jpg\');
imagedestroy($img);
}
//}
任何人都知道如何执行此操作-从指定位置获取图像并将其放在另一个图像上?谢谢!
没有找到相关结果
已邀请:
4 个回复
玩翁文醚碱
臀夯脖锑
才脊烽馈低
功能。快速搜索显示了该帖子可能会对您有所帮助。 http://forums.bit-tech.net/showthread.php?t=117270
埠仙俊