プロクシーしている画像を保存したら、正しいファイル名として保存する様に

このコミットが含まれているのは:
守矢諏訪子 2023-05-03 15:25:26 +09:00
コミット 6b4cf3feae
10個のファイルの変更51行の追加10行の削除

ファイルの表示

@ -1,3 +1,4 @@
<?php
define("SITEURL", "https://pixiv.owacon.moe");
define("SESSION_ID", "XXXXXXXX_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
?>

ファイルの表示

@ -3,12 +3,27 @@
<head>
<meta content="text/html; charset=euc-jp" http-equiv="content-type" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<?php if (isset($out["desc"])) { ?>
<?php if (isset($out["desc"])) { ?>
<meta property="og:site_name" content="vixip" />
<meta property="og:title" content="vixip 〜 <?= htmlspecialchars($out["title"]) ?>" />
<meta property="og:type" content="article" />
<meta property="og:description" content="<?= htmlspecialchars($out["desc"]) ?>" />
<meta property="og:url" content="<?= $gurl ?>" />
<?php } ?>
<meta property="og:url" content="<?= SITEURL.$cur ?>" />
<link rel="canonical" href="<?= SITEURL.$cur ?>" />
<meta property="twitter:card" content="summary_large_image" />
<meta property="twitter:url" content="<?= SITEURL.$cur ?>" />
<meta property="twitter:title" content="vixip 〜 <?= htmlspecialchars($out["title"]) ?>" />
<meta property="twitter:description" content="<?= htmlspecialchars($out["desc"]) ?>" />
<?php if (isset($out["img_sec"])) { ?>
<meta property="twitter:image" content="<?= SITEURL."/".$out["img_sec"].".php?".($out["img_sec"] == "artwork" ? "illust_" : "")."id=".$out["img_id"] ?>" />
<meta property="og:image" content="<?= SITEURL."/".$out["img_sec"].".php?".($out["img_sec"] == "artwork" ? "illust_" : "")."id=".$out["img_id"] ?>" />
<?php } else { ?>
<meta property="twitter:image" content="<?= SITEURL ?>/logo.png" />
<meta property="og:image" content="<?= SITEURL ?>/logo.png" />
<?php } ?>
<meta name="robots" content="max-image-preview:large" />
<meta name="description" content="<?= htmlspecialchars($out["desc"]) ?>" />
<?php } ?>
<?php if (isset($out["img"])) { ?><meta name="thumbnail" content="<?= $out["img"] ?>" /><?php } ?>
<title>vixip <?= htmlspecialchars($out["title"]) ?></title>
<link rel="stylesheet" type="text/css" href="/style.css" />

12
www/artwork.php ノーマルファイル
ファイルの表示

@ -0,0 +1,12 @@
<?php
require_once("../config.php");
$id = (int)$_GET["illust_id"];
header("Content-type: image/jpg");
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://embed.pixiv.net/artwork.php?illust_id=".$id);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_exec($ch);
curl_close($ch);
?>

ファイルの表示

@ -3,6 +3,7 @@
require_once("../../include/lib.php");
if (!isset($_GET["id"])) header("Location: /404.php");
$id = (int)$_GET["id"];
$cur = "/artworks/?id=".$id;
$res = get("illust/".$id);
if (!isset($res->body)) {
header("Location: /404.php");
@ -13,7 +14,7 @@
$com = get("illusts/comments/roots?illust_id=".$id);
}
$rec = get("illust/".$id."/recommend/init?limit=".$rpsize);
$out = ["title" => $res->alt, "desc" => $res->description];
$out = ["title" => $res->alt, "desc" => $res->description, "img_sec" => "artwork", "img_id" => $id];
$icon = "";
foreach ($res->userIllusts as $k => $v) {
if (is_null($v)) continue;
@ -24,9 +25,11 @@
<?php include("../../include/header.php"); ?>
<div style="text-align: center;">
<?php for ($i = 0; $i < $res->pageCount; $i++) { ?>
<a href="<?= imgprx(str_replace("_p0", "_p".$i, $res->urls->original)) ?>">
<img src="<?= imgprx(str_replace("_p0_", "_p".$i."_", $res->urls->regular)) ?>" alt="<?= $res->illustTitle ?>" />
</a>
<p>
<a href="<?= imgprx(str_replace("_p0", "_p".$i, $res->urls->original)) ?>">
<img src="<?= imgprx(str_replace("_p0_", "_p".$i."_", $res->urls->regular)) ?>" alt="<?= $res->illustTitle ?>" />
</a>
</p>
<?php } ?>
</div>
<h1><?= $res->illustTitle ?></h1>

ファイルの表示

@ -2,6 +2,7 @@
require_once("../api.php");
require_once("../include/lib.php");
$res = (array)get("top/illust");
$cur = "/";
$out = ["title" => "トップ", "desc" => ""];
?>

バイナリ
www/logo.png ノーマルファイル

バイナリファイルは表示されません。

変更後

幅:  |  高さ:  |  サイズ: 1.7 KiB

ファイルの表示

@ -1,11 +1,18 @@
<?php
require_once("../config.php");
$url = htmlspecialchars($_GET["url"]);
// ファイル類
$ext = explode(".", $url);
$ext = $ext[array_key_last($ext)];
if ($ext == "jpg") $ext = "jpeg";
// ファイル名
$fname = explode("/", $url);
$fname = $fname[array_key_last($fname)];
header("Content-type: image/".$ext);
header("Content-Disposition: filename=\"".$fname."\"");
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://".$url);

ファイルの表示

@ -6,6 +6,7 @@
header("Location: /");
die();
}
$cur = "/search/?q=".$q;
$res = get("search/artworks/".$q);
if ($res->error) die();

ファイルの表示

@ -3,6 +3,7 @@
require_once("../../../include/lib.php");
if (!isset($_GET["id"])) header("Location: /404.php");
$id = (int)$_GET["id"];
$cur = "/users/illusts/?id=".$id;
$page = isset($_GET["page"]) ? (int)$_GET["page"] : 1;
if ($page < 1) $page = 1;
$pagemax = 40;
@ -16,7 +17,7 @@
$res = $res->body;
$top = $top->body;
if (count((array)$res->illusts) == 0) header("Location: /404.php");
$out = ["title" => $top->extraData->meta->title, "desc" => $top->extraData->meta->description];
$out = ["title" => $top->extraData->meta->title, "desc" => $top->extraData->meta->description, "img_sec" => "userhead", "img_id" => $id];
$index = 0;
$illusts = count((array)$res->illusts);
@ -60,7 +61,6 @@
}
unset($top);
$cur = "/users/illusts/?id=".$id;
$sum = ceil($illusts/$pagemax);
include("../../../include/pagination.php");
include("../../../include/footer.php");

ファイルの表示

@ -2,6 +2,7 @@
require_once("../../api.php");
if (!isset($_GET["id"])) header("Location: /404.php");
$id = (int)$_GET["id"];
$cur = "/users/?id=".$id;
$res = get("user/".$id."/profile/all");
if (!isset($res->body)) {
header("Location: /404.php");
@ -10,7 +11,7 @@
$top = get("user/".$id."/profile/top");
$res = $res->body;
$top = $top->body;
$out = ["title" => $top->extraData->meta->title, "desc" => $top->extraData->meta->description];
$out = ["title" => $top->extraData->meta->title, "desc" => $top->extraData->meta->description, "img_sec" => "userhead", "img_id" => $id];
?>
<?php