1

我正在尝试创建图像来呈现天气数据:

<?php
header("Content-type: image/png");

$place = $_GET['place'];
$temp = $_GET['temp'];
$weather = $_GET['weather'];

$im_width = 150;
$im_height = 150;

$im = @imagecreate($im_width, $im_height);

$background_color = imagecolorallocate($im, 0, 0, 0);

$weather_im = imagecreatefrompng("images/". $weather .".png");
imagecopy($im, $weather_im, 0, 0, 0, 0, $im_width, $im_height);

$font = 'segoeui.ttf';
$font_color = imagecolorallocate($im, 255, 255, 255);

$temp_font_size = 24;

imagettftext($im, 16, 0, 5, $im_height-10, $font_color, $font, $place);
imagettftext($im, $temp_font_size, 1, $im_width-$temp_font_size, $im_height/2, $font_color, $font, $temp);

imagepng($im, '', 9);
imagedestroy($im);

?>

我得到了文字,但是在添加了另一个图像 13 之后,只有背景图像和那个图像。在我做图像复制之前,我也有文字:-/

4

0 回答 0