1

I have this code

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;
}

But i have error message: The image cannot be displayed because it contains errors.

The test is generated with a filetype png, and the thumbnail_s_fullpath is a relative url "./files/album/cache/73/36e53725bb03b301b8521c755c036994.png" (but i have try with full url).

I have readed this topics without results: php call a function from a img src

the image cannot be displayed because it contains errors

output an image in php

Krator
  • 15
  • 4

0 Answers0