<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<title>パス指定での画像表示</title>
<script>
window.onload = function() {
// URLからクエリパラメータを取得
const params = new URLSearchParams(window.location.search);
const filePath = params.get('path'); // 'path'はフォルダとファイル名を含むパラメータ名
const fileType = params.get('type'); // 'type'は画像ファイルのタイプ(拡張子)のパラメータ名
if (filePath && fileType) {
// パスとタイプを使用して画像の完全なパスを設定
const imagePath = filePath + '.' + fileType;
// img要素のsrc属性を更新して画像を表示
document.getElementById('imageDisplay').src = imagePath;
} else {
// 必要なパラメータがない場合の処理
document.getElementById('imageDisplay').alt = '画像ファイルパスまたはタイプが指定されていません';
}
}
</script>
</head>
<body>
<h2>パス指定での画像表示</h2>
<!-- 画像を表示するためのimg要素 -->
<img id="imageDisplay" alt="画像がここに表示されます">
</body>
</html>