이미지 가져오기 방식 변경

기존의 일반 wasabisyrup.com 이미지가 아닌 다른 방법으로 뿌려주도록 변경.
속도 느려질 수 있음.
This commit is contained in:
hakasenyang
2017-01-07 08:18:20 +09:00
parent c47a79a103
commit e1bc69e587
3 changed files with 40 additions and 5 deletions
+2 -2
View File
@@ -280,7 +280,7 @@ var EpisodePage = function (_React$Component) {
value: function _convertUrl(url) {
if (url.toLowerCase().indexOf("wasabisyrup") > -1) {
//var comps = url.split('/').slice(3);
//return config.apiUrl + "/image_parse.php?url=" + url;
return config.apiUrl + "/?imgurl=" + url;
//return config.apiUrl + "/image/" + comps.join("/");
}
return url;
@@ -538,7 +538,7 @@ var MangaItem = function (_React$Component) {
if (imageUrl.indexOf("marumaru.in") > -1) {
//var comps = imageUrl.split("\/").slice(3);
//imageUrl = config.apiUrl + "/preview/" + comps.join("/");
//imageUrl = config.apiUrl + "/image_parse.php?url=" + imageUrl;
imageUrl = config.apiUrl + "/?imgurl=" + imageUrl;
}
var content = _react2.default.createElement(
+2 -2
View File
@@ -12,7 +12,7 @@
</head>
<body style="margin:0px">
<div id="contents"></div>
<script src="config.js?20170106"></script>
<script src="app.js?20170106"></script>
<script src="config.js?2017010701"></script>
<script src="app.js?2017010701"></script>
</body>
</html>
+36 -1
View File
@@ -3,6 +3,41 @@
$marumaru = new Marumaru();
$num = $_GET['num'];
$image = $_GET['image'];
$imgurl = $_GET['imgurl'];
if(isset($imgurl))
{
$a = parse_url($imgurl);
switch($a['host'])
{
case 'www.yuncomics.com':
case 'wasabisyrup.com':
case 'blog.yuncomics.com':
case 'marumaru.in':
case 'www.wasabisyrup.com':
break;
default:
exit;
}
$last_modified = gmdate('D, d M Y H:i:s', time()) . ' GMT';
if (array_key_exists('HTTP_IF_MODIFIED_SINCE', $_SERVER))
{
$if_modified_since = strtotime(preg_replace('/;.*$/', '', $_SERVER['HTTP_IF_MODIFIED_SINCE']));
if ($if_modified_since >= $last_modified)
{
header($_SERVER['SERVER_PROTOCOL'].' 304 Not Modified');
exit();
}
}
header('Cache-Control: max-age=86400, public');
header('Expires: '. gmdate('D, d M Y H:i:s \G\M\T', time() + 86400));
header('Last-Modified: ' . gmdate('D, d M Y H:i:s',time() + 86400 ) . ' GMT' );
header('Content-Type: image/jpeg');
echo $marumaru->WEBParsing($imgurl, NULL, NULL);
exit;
}
if(!isset($num))
{
?>
@@ -103,7 +138,7 @@ startdata:
$jsonon = ($_GET['json'] == 1) ? true : false;
for($i=1;$i<count($aaa);$i++)
echo '<img src="'.trim(explode('"', $aaa[$i])[0]).'"><br>';
echo '<img src="?imgurl='.urlencode(trim(explode('"', $aaa[$i])[0])).'"><br>';
}
else
{