У меня есть Azure учетная запись для хранения BLOB-объектов и папка с множеством изображений внутри. Я хотел бы, чтобы изображения отображались на сайте. Путь к BLOB-объекту: https://example.blob.core.windows.net/example-media/facebook/ Первый файл ниже - index. php, а файл под ним - gallery. php.
На снимке экрана показано, как я буду sh отображать изображение. Буду благодарен за любую помощь и / или рекомендации.
<?php
$docRoot = $_SERVER['DOCUMENT_ROOT']; //Set document root
require_once "$docRoot/includes/config.php"; //Get global config file
require_once "$docRoot/includes/checklogin.php";
require_once "$docRoot/includes/gallery.php";
$path = "$docRoot" . "facebook/images";
$uri = 'images';
$page_name = "Facebook Image Gallery"; //Page name variable for use in title tag, etc.
//
// Let's reset the title to include the pagename, if it has one
// Shorthand PHP can be hard to read, this is an if (?), else(:)
//
$page_name != "" ? $site_title = $site_title." | ".$page_name : $site_title = $site_title;
?>
<!DOCTYPE html>
<html lang="en">
<?php
$docRoot = $_SERVER['DOCUMENT_ROOT'];
include "$docRoot/includes/header2.php";
?>
<div class="event-top">
<h1>Facebook Image Gallery</h1>
<p>Grab the list of thumbnail images to scroll, or click the forward/back arrow on the right/left of each image to navigate the gallery. Right-click and "Save Image as" to download.</p>
</div>
<div class="campaign-bottom container-fluid"> <!-- lower piece -->
<div class="fotorama" data-auto="false"></div>
</div>
<div class="clearfix"></div>
<script type="text/javascript">
$(function() {
var $window = $(window),
$body = $('body'),
pixelRatio = window.devicePixelRatio || 1,
width = Math.min(760 * pixelRatio, 1280),
ratio = 1.5,
thumbHeight = 56,
thumbWidth = thumbHeight * ratio;
var data = <?= json_encode(galleryContent($path, $uri)) ?>;
$('.fotorama').fotorama({
data: data,
clicktransition: 'dissolve',
width: '100%',
ratio: ratio,
hash: true,
maxheight: '100%',
nav: 'thumbs',
margin: 2,
shuffle: true,
thumbmargin: 2,
thumbwidth: thumbWidth,
thumbheight: thumbHeight,
allowfullscreen: 'native',
navposition: 'top',
keyboard: {
space: true
},
shadows: false,
fit: 'cover'
});
});
</script>
<?php
$docRoot = $_SERVER['DOCUMENT_ROOT'];
include "$docRoot/includes/footer2.php";
?>
</body>
</html>
<?php
/*function isNullOrWhitespace($str)
{
return ($str === null || (strlen(trim($str)) == 0)) ? TRUE : FALSE;
}*/
function galleryContent($path, $uri, $getFolders = false)
{
$list = [];
$parts = scandir($path);
//Look for extension matches and push
foreach ($parts as $name) {
//Clean up path
$fullPath = realpath($path . DIRECTORY_SEPARATOR . $name);
$isDirectory = is_dir($fullPath);
$match = null;
if (($getFolders == $isDirectory) && ($isDirectory
? ($name[0] != '.')
: (preg_match(GALLERY_REGEX, $name, $match) === 1)))
$list[] = [
'name' => $name,
'path' => $fullPath,
//Convert similar extension to single representation (add double tiff?)
'type' => $isDirectory ? 'directory' : str_replace(['jpeg', 'tiff'], ['jpg', 'tif'], $match[2]),
'img' => $uri . '/' . $name,
//'shortname' => $isDirectory ? $name : $match[1],
/*'video' => (!$isDirectory && is_file(
realpath($path . DIRECTORY_SEPARATOR . $match[1] . '.' . GALLERY_VIDEO_TYPE)
)) ? ($uri . '/' . $match[1] . '.' . GALLERY_VIDEO_TYPE) : null*/
'video' => (!$isDirectory && is_file(
realpath($path . DIRECTORY_SEPARATOR . $match[1] . '.' . 'mp4')
)) ? ($uri . '/' . $match[1] . '.' . 'mp4') : null
];
}
return $list;
}
?>