Filter on and output the correct content type #5

Merged
stoatally merged 1 commit from feature-content-type into master 2017-03-30 02:41:52 +02:00
2 changed files with 2 additions and 3 deletions
Showing only changes of commit 0f7875eeda - Show all commits

View file

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

View file

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