我有这段代码
switch ($pic_info['filetype'])
{
case 'gif':
$file_header = 'Content-Type: image/gif';
break;
case 'jpg':
$file_header = 'Content-Type: image/jpeg';
break;
case 'png':
$file_header = 'Content-Type: image/png';
break;
default:
image_no_thumbnail('thumb_' . $pic_info['title_reg'] . '.' . $pic_info['filetype']);
exit;
break;
}
if(($album_config['thumbnail_cache'] == true) && file_exists($pic_info['thumbnail_s_fullpath']))
{
header($file_header);
header('Content-Length: ' . filesize($pic_info['thumbnail_s_fullpath']));
header('Content-Disposition: filename=thumb_' . $pic_info['title_reg'] . '.' . $pic_info['filetype']);
readfile($pic_info['thumbnail_s_fullpath']);
exit;
}
但我有错误消息:无法显示图像,因为它包含错误。
使用文件类型png生成测试,并且thumbnail_s_fullpath是相对URL" ./ files / album / cache / 73 / 36e53725bb03b301b8521c755c036994.png" (但我尝试使用完整网址)。
我已经在没有结果的情况下重读了这个主题: php call a function from a img src