中文字幕在线观看,亚洲а∨天堂久久精品9966,亚洲成a人片在线观看你懂的,亚洲av成人片无码网站,亚洲国产精品无码久久久五月天

php 使用GD庫(kù)為圖片加水印

2018-07-20    來源:open-open

容器云強(qiáng)勢(shì)上線!快速搭建集群,上萬(wàn)Linux鏡像隨意使用
<?php  
header ("Content-type: image/png");  
$conn = MYSQL_connect("localhost", "root", "");     //連接數(shù)據(jù)庫(kù)  
$colname_rs_article = $_GET['id'];              //獲取參數(shù)id  

mysql_select_db("cms", $conn);                  //執(zhí)行SQL  
$query_rs_article = sprintf("SELECT * FROM articles WHERE article_id = %s", $colname_rs_article);  
$rs_article = mysql_query($query_rs_article, $conn) or die(mysql_error());  
$row_rs_article = mysql_fetch_assoc($rs_article);  
$totalRows_rs_article = mysql_num_rows($rs_article);  

$image = ImageCreateTrueColor(700, 1000);                   //創(chuàng)建畫布  
$bg = ImageColorAllocate($image, 255, 255, 255);        //設(shè)置背景為白色  
ImageFill($image, 0, 0, $bg);  
$text_color = ImageColorAllocate($image, 0, 0, 0);      //設(shè)置文字顏色為黑色  
imagestring($image, 5, 0, 0, $row_rs_article['title'], $text_color);        //輸出文章標(biāo)題  
imagestring($image, 3, 0, 20, $row_rs_article['author'], $text_color);  //輸出文章作者  
imagestring($image, 4, 0, 60, $row_rs_article['content'], $text_color); //輸出文章內(nèi)容  
$logo = ImageCreateFromPNG('logo.png');         //獲得水印圖片  
$logoW = ImageSX($logo);  
$logoH = ImageSY($logo);  
ImageCopy($image, $logo, 0, 0, 0, 0, $logoW, $logoH);           //合并文字圖片與水印圖片  
ImageJPEG($image); // output to browser  
ImageDestroy($logo);  
ImageDestroy($image);  
?>

標(biāo)簽: Mysql 數(shù)據(jù)庫(kù)

版權(quán)申明:本站文章部分自網(wǎng)絡(luò),如有侵權(quán),請(qǐng)聯(lián)系:west999com@outlook.com
特別注意:本站所有轉(zhuǎn)載文章言論不代表本站觀點(diǎn)!
本站所提供的圖片等素材,版權(quán)歸原作者所有,如需使用,請(qǐng)與原作者聯(lián)系。

上一篇:PHP遞歸對(duì)文件夾遞歸執(zhí)行chmod命令

下一篇:Python3.4 郵件發(fā)送(含帶中文附件)