【发布时间】:2010-05-08 05:58:57
【问题描述】:
<?php
function LoadPNG()
{
/* Attempt to open */
//require_once 'resizex.php';
$imgname="/home2/puneetbh/public_html/prideofhome/wp-content/uploads/268995481image_11.png";
//$im = @imagecreatefrompng($imgname);
$img= imagecreatefromstring(file_get_contents($imgname));
//$im=imagecreatefrompng('images/frame.png');
$im= imagecreatefromjpeg('images/frame.jpeg');
//imagealphablending($img, false);
//imagesavealpha($img, true);
//$img=resizex("$url",60,65,1);
imagecopymerge($im,$img,105,93,0, 0,275,258,100);
/* See if it failed */
if(!$im)
{
/* Create a blank image */
$im = imagecreatetruecolor(150, 30);
$bgc = imagecolorallocate($im, 255, 255, 255);
$tc = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 150, 30, $bgc);
/* Output an error message */
imagestring($im, 1, 5, 5, 'Error loading ' . $imgname, $tc);
}
return $im;
}
$img = LoadPNG();
header('Content-type: image/jpeg');
imagejpeg($im);
imagedestroy($im);
imagedestroy($img);
?>
我收到错误 arning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: gd-jpeg: JPEG library reports unrecoverable error: in /home2/puneetbh/public_html/prideapp/frame.php on line 11
警告:imagecreatefromjpeg() [function.imagecreatefromjpeg]: 'images/frame.jpeg' 不是第 11 行 /home2/puneetbh/public_html/prideapp/frame.php 中的有效 JPEG 文件
警告:imagecopymerge():提供的参数不是第 16 行 /home2/puneetbh/public_html/prideapp/frame.php 中的有效图像资源
警告:无法修改标头信息 - 标头已由第 34 行 /home2/puneetbh/public_html/prideapp/frame.php 中的 /home2/puneetbh/public_html/prideapp/frame.php:11 发送的标头
警告:imagejpeg():提供的参数不是第 35 行 /home2/puneetbh/public_html/prideapp/frame.php 中的有效图像资源
警告:imagedestroy():提供的参数不是第 36 行 /home2/puneetbh/public_html/prideapp/frame.php 中的有效图像资源
【问题讨论】:
-
请编辑您的问题以将其格式化为代码。
-
选择编码部分并按下“010101”按钮以获得完美的外观,并使用“编辑器按钮”对警告和错误进行注释
-
错误消息表明 GD 库确实找到了文件
images/frame.jpeg,但它不是有效的 JPEG 文件。您能否上传一份此文件的副本,以便我们看一看?