includeGraphics: Clean up thumbnail generation
This commit is contained in:
parent
bb6ef06207
commit
7b17d29094
@ -6,7 +6,7 @@
|
|||||||
define('HOME_PAGE', 'blog'); // Entry page (and link for logo)
|
define('HOME_PAGE', 'blog'); // Entry page (and link for logo)
|
||||||
define('CACHE_POSTS_TTL', 3600); // Time to cache the posts list (1h)
|
define('CACHE_POSTS_TTL', 3600); // Time to cache the posts list (1h)
|
||||||
define('POSTS_BASE', "/b/"); // Root directory of the posts (relative)
|
define('POSTS_BASE', "/b/"); // Root directory of the posts (relative)
|
||||||
define('YT_PREVIEW', "/b/pimg-yt/"); // Directory containing local copies of the youtube thumbnails
|
define('PREVIEW_BASE', "/pimg/"); // Directory to store auto-generated thumbnails
|
||||||
define('POSTS_ROOT', $_SERVER['DOCUMENT_ROOT'] . POSTS_BASE); // Root directory of the posts (absolute)
|
define('POSTS_ROOT', $_SERVER['DOCUMENT_ROOT'] . POSTS_BASE); // Root directory of the posts (absolute)
|
||||||
define('POSTS_PAGE_SIZE', 10); // Numbers of posts on a page
|
define('POSTS_PAGE_SIZE', 10); // Numbers of posts on a page
|
||||||
|
|
||||||
@ -75,7 +75,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($preview == "+") {
|
if ($preview == "+") {
|
||||||
$previewPath = POSTS_BASE . "pimg/" . str_replace("/", "_", $path);
|
$previewPath = PREVIEW_BASE . str_replace("/", "_", $path);
|
||||||
$fpreviewPath = $_SERVER['DOCUMENT_ROOT'] . $previewPath;
|
$fpreviewPath = $_SERVER['DOCUMENT_ROOT'] . $previewPath;
|
||||||
if (!file_exists($fpreviewPath)) {
|
if (!file_exists($fpreviewPath)) {
|
||||||
preg_match("/^[A-Za-z_\.\-0-9\/]*$/", $fpath, $matches); // SANITIZED!
|
preg_match("/^[A-Za-z_\.\-0-9\/]*$/", $fpath, $matches); // SANITIZED!
|
||||||
@ -137,7 +137,7 @@
|
|||||||
} else if (opted_in('y')) {
|
} else if (opted_in('y')) {
|
||||||
echo '<iframe width="100%" height="100%" src="' . $url . '" frameborder="0" allowfullscreen></iframe>';
|
echo '<iframe width="100%" height="100%" src="' . $url . '" frameborder="0" allowfullscreen></iframe>';
|
||||||
} else {
|
} else {
|
||||||
$preview_file = YT_PREVIEW . $youtube['vid'] . ".jpg";
|
$preview_file = PREVIEW_BASE . $youtube['vid'] . ".jpg";
|
||||||
if (!file_exists($_SERVER['DOCUMENT_ROOT'] . $preview_file)) {
|
if (!file_exists($_SERVER['DOCUMENT_ROOT'] . $preview_file)) {
|
||||||
file_put_contents($_SERVER['DOCUMENT_ROOT'] . $preview_file, file_get_contents("https://img.youtube.com/vi/" . $youtube['vid'] . "/maxresdefault.jpg"));
|
file_put_contents($_SERVER['DOCUMENT_ROOT'] . $preview_file, file_get_contents("https://img.youtube.com/vi/" . $youtube['vid'] . "/maxresdefault.jpg"));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user