-
-
header ("content-type: image/png"); - $conn = mysql_connect("localhost", "root", ""); //Connect to the database
- $colname_rs_article = $_get['id']; //Get parameter id
mysql_select_db("cms", $conn); //Execute 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 ); //Set the background to white
- imagefill($image, 0, 0, $bg);
- $text_color = imagecolorallocate($image, 0, 0, 0); //Set the text color to black
- imagestring($image, 5 , 0, 0, $row_rs_article['title'], $text_color); //Output the article title
- imagestring($image, 3, 0, 20, $row_rs_article['author'], $text_color); //Output the article Author
- imagestring($image, 4, 0, 60, $row_rs_article['content'], $text_color); //Output article content
- $logo = imagecreatefrompng('logo.png'); //Get watermark image
- $ logow = imagesx($logo);
- $logoh = imagesy($logo);
- imagecopy($image, $logo, 0, 0, 0, 0, $logow, $logoh); //Merge text images and watermark images
- imagejpeg($image); // output to browser
- imagedestroy($logo);
- imagedestroy($image);
- ?>
-
-
-
- Copy code
|