<?php
$issue = $_GET['issue'];
$files = glob("$issue/*.{jpg,jpeg,gif,jp2,png}", GLOB_BRACE);
$downloads = glob("$issue/*.{zip,cbz,cbr,rar}", GLOB_BRACE);
$icon = glob("$issue/icon/*.{jpg,jpeg,gif,jp2,png}", GLOB_BRACE);
for ($i=0; $i<count($icon); $i++) {
$iconImg = $icon[$i];
}
if($iconImg){
$thumbImg = $iconImg;
}else{
$thumbImg = 'https://www.imageurl/image_title.jpg';
}
?>
<?php for ($i=0; $i<count($files); $i++) {
$img = $files[$i];
echo' <section class="slide" data-name="page'.$i.'"><div class="content image-box"><img src="'.$img.'"/></div></section>';
}
?>
I use this to pull a series of images from a directory to form an array of images and links.
I'm using the $icon to use either a custom icon for the mobile touch icons, and if that icon is missing from the icon directory it will pull a default image url.
See it in action here: https://pulplibrary.com/
I'm using the $icon to use either a custom icon for the mobile touch icons, and if that icon is missing from the icon directory it will pull a default image url.
See it in action here: https://pulplibrary.com/
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.