Photo sphere viewer
接口演示
接口说明
http://qj.blans.top/index.php?p1=全景图URL(http协议)
1、p1参数为全景图图片文件地址,值为URL链接,
例:
2、图片要求为

接口解释
网页代码:
<head>
<!-- for optimal display on high DPI devices -->
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
//css文件
<link rel="stylesheet" href="css/index.min.css" />
</head>
<!-- the viewer container must have a defined size -->
<div id="viewer" style="width: 100vw; height: 100vh;"></div>
<script type="importmap">
{
"imports": {
// js库
"three": "three.module.js",
"@photo-sphere-viewer/core": "index.module.js"
}
}
</script>
<?php
// 读取GET数据并赋值给变量
// 例 http://blans.top/bl/qj/index.php?p1=link1
$param1 = $_GET['p1'];
?>
<script type="module">
import { Viewer } from '@photo-sphere-viewer/core';
const viewer = new Viewer({
container: document.querySelector('#viewer'),
// PHP读取Get变量的值赋值给js变量
// 注意图片尺寸2/1
panorama: '<?php echo $param1; ?>',
});
</script>
