数码资讯
PHP使用GD库为页面添加水印示例代码。
复制代码代码如下所示: < PHP 页眉(内容类型:图像); $ conn = mysql_connect(localhost colname_rs_article美元=美元_get { 'id' }; / /获得ID参数 mysql_select_db(CMS,$ Conn); / / SQL q
选购提示
关注价格、性能、续航、售后和真实使用场景,理性比较后再下单。
复制代码代码如下所示:
< PHP
页眉(内容类型:图像);
$ conn = mysql_connect(localhost
colname_rs_article美元=美元_get { 'id' }; / /获得ID参数
mysql_select_db(CMS,$ Conn); / / SQL
query_rs_article美元= sprintf(选择*从文章里article_id = %s
rs_article = mysql_query美元(美元美元query_rs_article,Conn)或死亡(mysql_error());
row_rs_article = mysql_fetch_assoc美元(美元rs_article);
totalrows_rs_article = mysql_num_rows美元(美元rs_article);
$图像=新建一个真彩色图像(700, 1000); / /创建画布
BG = imagecolorallocate美元(美元形象,255, 255, 255); / /设置白色背景
imagefill($ 0, 0美元的形象,BG);
text_color美元= imagecolorallocate(合图像,0, 0, 0); / /黑色设置文字颜色
imagestring($ 5, 0, 0美元的形象,row_rs_article {标题},text_color美元); / /文章的标题
imagestring($ 3, 0, 20美元的形象,row_rs_article { 'author},text_color美元); / /输出的作家
imagestring($ 4, 0, 60美元的形象,row_rs_article { 'content' },text_color美元); / /输出内容的文章
$标志= imagecreatefrompng('logo。PNG '); / /得到水印图像
logow美元= imagesx($标志);
logoh美元= imagesy($标志);
imagecopy(合图像,标志0, 0, 0,0美元,美元,美元,logow,logoh); / /合并的文本图像和水印图像
imagejpeg($图像); / /输出到浏览器
销毁一图像($标志);
销毁一图像($图像);
>
< PHP
页眉(内容类型:图像);
$ conn = mysql_connect(localhost
colname_rs_article美元=美元_get { 'id' }; / /获得ID参数
mysql_select_db(CMS,$ Conn); / / SQL
query_rs_article美元= sprintf(选择*从文章里article_id = %s
rs_article = mysql_query美元(美元美元query_rs_article,Conn)或死亡(mysql_error());
row_rs_article = mysql_fetch_assoc美元(美元rs_article);
totalrows_rs_article = mysql_num_rows美元(美元rs_article);
$图像=新建一个真彩色图像(700, 1000); / /创建画布
BG = imagecolorallocate美元(美元形象,255, 255, 255); / /设置白色背景
imagefill($ 0, 0美元的形象,BG);
text_color美元= imagecolorallocate(合图像,0, 0, 0); / /黑色设置文字颜色
imagestring($ 5, 0, 0美元的形象,row_rs_article {标题},text_color美元); / /文章的标题
imagestring($ 3, 0, 20美元的形象,row_rs_article { 'author},text_color美元); / /输出的作家
imagestring($ 4, 0, 60美元的形象,row_rs_article { 'content' },text_color美元); / /输出内容的文章
$标志= imagecreatefrompng('logo。PNG '); / /得到水印图像
logow美元= imagesx($标志);
logoh美元= imagesy($标志);
imagecopy(合图像,标志0, 0, 0,0美元,美元,美元,logow,logoh); / /合并的文本图像和水印图像
imagejpeg($图像); / /输出到浏览器
销毁一图像($标志);
销毁一图像($图像);
>
声明:本文内容用于数码产品信息整理与选购参考,具体价格、库存、售后政策以官方渠道和电商页面实时信息为准。