gpt4 book ai didi

php - 图像无法显示,因为它包含错误 [Image generator]

转载 作者:塔克拉玛干 更新时间:2023-11-03 06:05:41 24 4
gpt4 key购买 nike

图像生成器有一些问题。也许你会发现问题是什么?我得到:“图像无法显示,因为它包含错误”,我正在下载图像文件,但没有错误。

<?php
if(isset($_GET['id']) && $_GET['id']){
// require('../libs/global.inc.php');
$id = $_GET['id'];
$imagePath = "gov_220.jpg";//$track->getImg($id);
$framePath = "otgFrame.png";
$fontsize = 14;
$font = 'times.ttf';
$artistName = "bla bla";//$view->CutTheName("by ".$track->getArtist($id), 16);
//$artistName = iconv(mb_detect_encoding($artistName, mb_detect_order(), true), "UTF-8", $artistName);
$trackName = "la la";//$view->CutTheName($track->getName($id),16);
$photo = imagecreatefromjpeg($imagePath);
$w = imagesx($photo);
$h = imagesy($photo);

$new_image = imagecreatetruecolor(200, 200);
imagecopyresampled($new_image, $photo, 0, 0, 0, 0, 200, 200, $w, $h);

imagealphablending($new_image,true);

$frame = imagecreatefrompng($framePath);
imagecopy($new_image,$frame,0,0,0,0,200,200);
$fontcolor = imagecolorallocate($new_image, 255, 255, 255);
imagettftext($new_image, $fontsize, 0,2,177,$fontcolor, $font, $trackName );
$fontcolor = imagecolorallocate($new_image, 246, 228, 6);
imagettftext($new_image, $fontsize, 0,2,196,$fontcolor, $font, $artistName );
header('Content-type: image/png');
imagepng($new_image);
imagedestroy ($new_image);
}
?>

最佳答案

在文本编辑器中打开图像,我想你会在那里找到来自 php 的警告。

关于php - 图像无法显示,因为它包含错误 [Image generator],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18207352/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com