Skip to content
Snippets Groups Projects
Commit 11fd83a8 authored by Jan Grewe's avatar Jan Grewe
Browse files

fix paths with single quote

only generate artwork if source exists
parent 2394f923
Branches
No related tags found
No related merge requests found
......@@ -37,13 +37,11 @@ if ($_GET['get'] == 'poster' && !empty($_GET['show'])) {
if(!file_exists($poster)) {
if($_GET['season'])
$source = $showsPath.'/'.addslashes($_GET['show']).'/season'.$_GET['season'].'-poster.jpg';
$source = $showsPath.'/'.$_GET['show'].'/season'.$_GET['season'].'-poster.jpg';
else
$source = $showsPath.'/'.addslashes($_GET['show']).'/poster.jpg';
$source = $showsPath.'/'.$_GET['show'].'/poster.jpg';
if(!file_exists($source)) {
$source = 'img/no_poster.jpg';
}
if(file_exists($source)) {
$img = new Imagick();
$img->setOption('jpeg:size', '800x532');
$img->readImage($source);
......@@ -51,15 +49,14 @@ if ($_GET['get'] == 'poster' && !empty($_GET['show'])) {
$img->setImageCompression(Imagick::COMPRESSION_JPEG);
$img->setImageCompressionQuality(80);
$img->writeImage($poster);
}else{
$poster = 'img/no_poster.jpg';
}
}
header('Content-type: image/jpeg');
header('Content-length: '.filesize($poster));
$file = @fopen($poster, 'rb');
if ($file) {
fpassthru($file);
exit;
}
readfile($poster);
die;
}
......@@ -68,10 +65,8 @@ if ($_GET['get'] == 'fanart' && !empty($_GET['show'])) {
$fanart = 'fanart/'.cleanName($_GET['show']).'.jpg';
if(!file_exists($fanart)) {
$source = $showsPath.'/'.addslashes($_GET['show']).'/fanart.jpg';
if(!file_exists($source)) {
$source = 'img/no_fanart.jpg';
}
$source = $showsPath.'/'.$_GET['show'].'/fanart.jpg';
if(file_exists($source)) {
$img = new Imagick();
$img->setOption('jpeg:size', '1280x720');
$img->readImage($source);
......@@ -84,15 +79,14 @@ if ($_GET['get'] == 'fanart' && !empty($_GET['show'])) {
$img->setImageCompression(Imagick::COMPRESSION_JPEG);
$img->setImageCompressionQuality(75);
$img->writeImage($fanart);
}else{
$fanart = 'img/no_fanart.jpg';
}
}
header('Content-type: image/jpeg');
header('Content-length: '.filesize($fanart));
$file = @fopen($fanart, 'rb');
if ($file) {
fpassthru($file);
exit;
}
readfile($fanart);
die;
}
......@@ -101,25 +95,21 @@ if ($_GET['get'] == 'logo' && !empty($_GET['show'])) {
$logo = 'logo/'.cleanName($_GET['show']).'.png';
if(!file_exists($logo)) {
$source = $showsPath.'/'.addslashes($_GET['show']).'/logo.png';
if(!file_exists($source)) {
header("HTTP/1.0 404 Not Found");
die;
}else{
$source = $showsPath.'/'.$_GET['show'].'/clearlogo.png';
if(file_exists($source)) {
$img = new Imagick();
$img->readImage($source);
$img->thumbnailImage(0, 50);
$img->writeImage($logo);
}else{
header("HTTP/1.0 404 Not Found");
die;
}
}
header('Content-type: image/jpeg');
header('Content-type: image/png');
header('Content-length: '.filesize($logo));
$file = @fopen($logo, 'rb');
if ($file) {
fpassthru($file);
exit;
}
readfile($logo);
die;
}
......
img/no_fanart.jpg

71.5 KiB | W: | H:

img/no_fanart.jpg

68.6 KiB | W: | H:

img/no_fanart.jpg
img/no_fanart.jpg
img/no_fanart.jpg
img/no_fanart.jpg
  • 2-up
  • Swipe
  • Onion skin
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment