我有一个问题,我有一个软件可以获取 pc 技术规格并将它们发布到网上,我们为每个规格提供了一个签名图像,这是由 php 创建的,但不再工作了;演示链接:http ://checkmyspecs.co.uk/button.php?id=646725或转到任何规格页面,例如:http ://www.checkmyspecs.co.uk/display2.php?id=646725及以下页面上是抓取按钮代码。
图片必须由 button.php 创建,代码如下:
<?php
include "db.php";
function getdata($viewerid) {
$query = "SELECT * FROM data where viewerid = '$viewerid'";
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result) or die(mysql_error());
$data = array();
array_push($data,$row['bootmethod'],$row['ComputerCaption'],$row['Infrared'],$row['DayLight'],$row['ManufacturerBox'],$row['Model'],$row['cores'],$row['memory'],$row['monitor'],$row['resolution'],$row['pixels'],$row['cpuvoltage'],$row['clockspeed'],$row['AddressWidth'],$row['SocketDesignation'],$row['cpuname'],$row['loadpercent'],$row['applications'],$row['videocardname'],$row['refreshrate'],$row['videodriver'],$row['installed'],$row['hddata'],$row['directx']);
return $data;
}
function LoadPNG($imgname,$cur)
{
$getvalues = getdata($cur);
/* Attempt to open */
$im = @imagecreatefrompng($imgname);
// Removes white background (made from the original transparency)
$white = imagecolorallocate($im, 255, 255, 255);
// Make the background transparent
//Generate the text to write onto the image (the php Version).
//Don't know much about this
// Add some shadow to the text
$white = imagecolorallocate($im, 255, 255, 255);
$grey = imagecolorallocate($im, 128, 128, 128);
$black = imagecolorallocate($im, 0, 0, 0);
$blue = imagecolorallocate($im, 0, 173, 238);
$darkblue = imagecolorallocate($im, 54, 154, 191);
$font = '/fonts/arialbd.ttf';
$ramo = $getvalues[7];
$cpuo = $getvalues[15];
$gpuo = $getvalues[18];
$screeno = $getvalues[9];
$ram = "$ramo MB";
$cpu = "$cpuo";
$gpu = "$gpuo ";
$screen = "$screeno";
imagettftext($im, 11, 0, 40, 23, $black, $font, $cpu);
imagettftext($im, 11, 0, 40, 53, $black, $font, $gpu);
imagettftext($im, 11, 0, 40, 83, $black, $font, $screen);
imagettftext($im, 11, 0, 40, 113, $black, $font, $ram);
// write text
$textcolor = imagecolorallocate($im, 0, 3, 0);
return $im;
}
header('Content-Type: image/png');
$button = '/images/button.png';
$img = LoadPNG($button,$_GET['id']);
imagepng($img);
?>