Merge pull request #5 from stoatally/feature-content-type

Filter on and output the correct content type
This commit is contained in:
Jeremy Kauffman 2017-03-29 20:41:51 -04:00 committed by GitHub
commit 5c38fb0b21
2 changed files with 2 additions and 3 deletions

View file

@ -64,6 +64,7 @@ class LBRY
return
//TODO: Expand these checks AND verify it is an image claim!
($metadata['license'] == "Public Domain" || stripos($metadata['license'], 'Creative Commons') !== false) &&
in_array($metadata['content_type'], ['image/jpeg', 'image/png']) &&
!isset($metadata['fee']);
});

View file

@ -11,9 +11,7 @@ if ($claim)
if (isset($getResult['completed']) && $getResult['completed'] && isset($getResult['download_path']))
{
$path = $getResult['download_path'];
//TODO, verify it is an image
//TODO: serve the correct content type!
header('Content-type: image/jpeg');
header('Content-type: ' . $getResult['metadata']['content_type']);
header('Content-length: ' . filesize($path));
readfile($getResult['download_path']);
}