Random logo on page load

Need some custom code changes to the phpBB core simple enough that you feel doesn't require an extension? Then post your request here so that community members can provide some assistance.

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTE: NO OFFICIAL SUPPORT IS PROVIDED IN THIS SUB-FORUM
Post Reply
User avatar
moosepucky
Registered User
Posts: 5
Joined: Tue Oct 24, 2017 5:01 pm

Random logo on page load

Post by moosepucky »

phpBB version: 3.2.2
Style: myInvision 3.3.0
PHP version: 7.0
MySQL: 5.5.58

I have a simple php script that reads the content of a folder and generates a random 100x100 px logo graphic

I've spend most of the day today searching the forum and trying many of the suggestions that appeared would work without success. There appears to be a few abandoned extensions that are recommended to NOT use

I would "like" to call the script in with a php include so that I do not need to do a lot of re-coding after a product update/upgrade. I have enough file customization already to deal with so prefer a single include line

Code: Select all

<?php
$imagesDir = 'img/';
$images = glob($imagesDir . '*.{jpg,jpeg,png,gif}', GLOB_BRACE);
$randomImage = $images[array_rand($images)]; 
echo '<img src="'.$randomImage.'" />';
?>
This file is now in: forums/styles/MyInvision/template/random-logo/
the images are in a subfolder of random-images called img

Code runs fine as a standalone: https://forums.toyota-campers.com/style ... m-logo.php

Each page refresh selects an image to display.

Thanks for any help in sorting this out
Post Reply

Return to “phpBB Custom Coding”