daily pastebin goal
42%
SHARE
TWEET

BLUMAN.net Image Population

fidle89 Feb 6th, 2019 (edited) 28 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. // This is the multi-dimensional array which sits at the top of the page. Notice how easy it is to change each specific page name (for the divExpand JS), title (for the front-end), directory and also how easy it is to create another page.
  4. $imgBankArray = [
  5.     'img150' => [
  6.         'name' => 'imgAvatar150',
  7.         'title' => 'Avatars (150x150)',
  8.         'directory' => 'avatars/150x150',
  9.         'parse' => ''
  10.     ],
  11.     'img165' => [
  12.         'name' => 'imgAvatar165',
  13.         'title' => 'Avatars (165x165)',
  14.         'directory' => 'avatars/165x165',
  15.         'parse' => ''
  16.     ],
  17.     'img150200' => [
  18.         'name' => 'imgAvatar150200',
  19.         'title' => 'Avatars (150x200)',
  20.         'directory' => 'avatars/150x200',
  21.         'parse' => ''
  22.     ],
  23.     'imgSig' => [
  24.         'name' => 'imgSig',
  25.         'title' => 'Forum Signatures',
  26.         'directory' => 'signatures',
  27.         'parse' => '<br>'
  28.     ],
  29.     'imgHead' => [
  30.         'name' => 'imgHead',
  31.         'title' => 'Headers & Logos',
  32.         'directory' => 'headers',
  33.         'parse' => '<br>'
  34.     ]
  35. ];
  36.  
  37. ?>
  38.  
  39. // --------------------- [ Mass code skipped ] ------------------------------
  40.  
  41. <!-- This is a snippet which consists of the 'graphics' page area. Notice how the first loop iterates over the multi-dimensional array and there's a second loop to iterate over each image located in the directory specified by the array. -->
  42. <div class="page" id="graphics">
  43.     <div class="container-lg">
  44.         <div class="grid-container-large">
  45.             <?php foreach ($imgBankArray as $category) : ?>
  46.             <div class="grid-item">
  47.                 <div onclick="divExpand('<?= $category['name'] ?>')"><a class="grid-title"><?= $category['title'] ?></a></div>
  48.                 <div id="<?= $category['name'] ?>" class="grid-content">
  49.                     <div id="grid-hr"></div>
  50.                     <?php $grabImage = glob('graphics/'.$category['directory'].'/*.{png,gif}', GLOB_BRACE); ?>
  51.                     <center><br>
  52.                     <?php foreach ($grabImage as $mass) : ?>
  53.                     <img src="<?= $mass ?>"><?= $category['parse'] ?>
  54.                     <?php endforeach; ?>
  55.                     </center>
  56.                 </div>
  57.             </div>
  58.             <?php endforeach; ?>
  59.         </div>
  60.     </div>
  61. </div>
  62.  
  63. <!-- Source code specified by Nathan, originally created for BLUMAN.net. You may re-use this code for your own personal usage. -->
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top