이 .php 파일을 .png 파일로 사용하려고합니다. <img src='test.php'>
[예]PHP 이미지가 작동하지 않습니다.
나는 이미지로 헤더를 추가하고이했다 :
<?php
/* Start Connection */
[Ignore This]
/* End Connection */
/* Add to counter */
mysql_query("UPDATE counter SET counter = counter + 1");
/* End Add */
/* For Echo */
$count = mysql_fetch_row(mysql_query("SELECT counter FROM counter"));
$hits = $count[0];
/* Create Echo as Null
* @echo
echo "$hits";
*/
/* End Echo */
//Img Area
$font = "font.ttf";
$image = imagecreatefrompng("hits.png");
$color = imagecolorallocate($image, 255, 255, 255);
imagettftext($image, 15, 0, 10, 24, $color, $font, $hits);
imagepng($image, "test.png");
imagedestroy($image);
header('Content-Type: image/png')
?>
을하지만 그것은 단지 깨진 이미지를 표시합니다.
이 파일은
나는이 문제를 어떻게 해결할 수
img.php깨진 이미지가 img.php이다?
mysql_ *은 일반적으로 새 코드에서 PDO 나 MySQLi를 사용하지 않는 것이 좋습니다. – Corbin