スポンサーサイト
上記の広告は1ヶ月以上更新のないブログに表示されています。
新しい記事を書く事で広告が消せます。
新しい記事を書く事で広告が消せます。
エロ目的でプログラマーになりたいブラザーの為、エロ、非エロ問わずプログラムの知識や勉強になったことを色々とぶちまけます。
<?php
$body = "";
if (isset($_POST['url'])) {
$url = $_POST['url'];
$json = file_get_contents('http://api.erodouga-rin.net/thumbnails?url='.$url);
if ($json != false) {
$obj = json_decode($json, true);
if (isset($obj['status'], $obj['thumbnails']) && $obj['status'] == "success") {
$thums = $obj['thumbnails'];
$max = count($thums);
for ($i = 0; $i < $max; $i++) {
$imgurl = $thums[$i];
$body .= '<img src="'.$imgurl.'">';
}
} else {
$body .= '<p>取得に失敗しました。</p>';
}
}
} else {
$body .= '<p>xvideos動画のURLを貼り付けてください。</p>';
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>XVIDEOS動画を画像で取得</title>
</head>
<body>
<form action="index.php" method="POST">
<input type="text" name="url" style="width:500px;" value="">
<input type="submit" value="画像リスト取得">
<hr/>
<?= $body ?>
</body>
</html>
<?php
$body = "";
if (isset($_POST['url'])) {
$url = $_POST['url'];
$json = file_get_contents('http://api.erodouga-rin.net/thumbnails?url='.$url);
if ($json != false) {
$obj = json_decode($json, true);
if (isset($obj['status'], $obj['thumbnails']) && $obj['status'] == "success") {
$thums = $obj['thumbnails'];
$max = count($thums);
$imgDst = "";
$wid = $hei = $ofsy = 0;
for ($i = 0; $i < $max; $i++) {
//$imgurl = $thums[$i];
//$body .= '<img src="'.$imgurl.'">';
$imgurl = str_replace('thumbs', 'thumbslll', $thums[$i]);
$imgSrc = imagecreatefromjpeg($imgurl);
if ($imgSrc) {
if ($imgDst == "") {
$wid = imagesx($imgSrc);
$hei = imagesy($imgSrc);
$imgDst = imagecreatetruecolor($wid, $hei * $max);
$white = imagecolorallocate($imgDst, 0xFF, 0xFF, 0xFF);
imagefill($imgDst, 0, 0, $white);
imagecopy($imgDst, $imgSrc, 0, $ofsy, 0, 0, $wid, $hei);
$ofsy += $hei;
} else {
imagecopy($imgDst, $imgSrc, 0, $ofsy, 0, 0, $wid, $hei);
$ofsy += $hei;
}
imagedestroy($imgSrc);
}
}
if ($imgDst) {
//imagejpeg($imgDst, 'thums.jpg'); // ファイルとして保存。Parmission設定してれば使える
ob_start();
imagejpeg($imgDst);
$imgData = ob_get_contents();
ob_end_clean();
$body .= '<img src="data:image/jpeg;base64,'.base64_encode($imgData).'">';
imagedestroy($imgDst);
}
} else {
$body .= '<p>取得に失敗しました。</p>';
}
}
} else {
$body .= '<p>xvideos動画のURLを貼り付けてください。</p>';
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>XVIDEOS動画を画像で取得</title>
</head>
<body>
<form action="index.php" method="POST">
<input type="text" name="url" style="width:500px;" value="">
<input type="submit" value="画像リスト取得">
<hr/>
<?= $body ?>
</body>
</html>
コメントの投稿