Other Display a Random Logo

D

Deleted member 745

Guest
Hi,

I'm wanting a Random Logo, I have the script just don't know how to add it in the header, it's a PHP file.

Does anyone know how to get the PHP file to work in a template/callback as it wont work under the Logo URL or template (PAGE_CONTAINER)

I'm willing to pay for this, if needed - As I need it for my 4 logos, I've had made.

Thanks

PS - Not sure where to put this thread sorry if its in the wrong forum.
 
Create logo.php file with this code:
PHP:
<?php
$images = array('https://www.vistosi.com/assets/templates/vistosi/skin/images/vistosi/logo@2x.png', 'http://cdn3.bigcommerce.com/s-mtgt3co/product_images/goodbyn_logo_1430427079__53559.png', 'http://www.startec.com.my/wp-content/uploads/2010/08/Startecs-Logo-250x100.jpg');
$random_image = array_rand($images);
header('Location: '.$images[$random_image]);

upload the php file to your hosting and add this url to your logo url config.
etc: http://localhost.com/logo.png

HTML:
<img src="http://localhost/logo.php">
 
Create logo.php file with this code:
PHP:
<?php
$images = array('https://www.vistosi.com/assets/templates/vistosi/skin/images/vistosi/logo@2x.png', 'http://cdn3.bigcommerce.com/s-mtgt3co/product_images/goodbyn_logo_1430427079__53559.png', 'http://www.startec.com.my/wp-content/uploads/2010/08/Startecs-Logo-250x100.jpg');
$random_image = array_rand($images);
header('Location: '.$images[$random_image]);

upload the php file to your hosting and add this url to your logo url config.
etc: http://localhost.com/logo.png

HTML:
<img src="http://localhost/logo.php">

How would I do it so the random image is a set height and width, please?
 
Create logo.php file with this code:
PHP:
<?php
$images = array('https://www.vistosi.com/assets/templates/vistosi/skin/images/vistosi/logo@2x.png', 'http://cdn3.bigcommerce.com/s-mtgt3co/product_images/goodbyn_logo_1430427079__53559.png', 'http://www.startec.com.my/wp-content/uploads/2010/08/Startecs-Logo-250x100.jpg');
$random_image = array_rand($images);
header('Location: '.$images[$random_image]);

upload the php file to your hosting and add this url to your logo url config.
etc: http://localhost.com/logo.png

HTML:
<img src="http://localhost/logo.php">
Will this still work with the newest XenForo?
 
There's a way of doing it without using PHP.

 
There's a way of doing it without using PHP.

Where do I add this code for a random logo?

<img src="{{ base_url(('styles/default/images/image_' . rand(1,5) . '.png')) }}" />

As adding it the old way inside the Logo URL does not work?
 
Would I add it in the PAGE_CONTAINER here?

from
<img src="{{ base_url(property('publicLogoUrl')) }}" srcset="{$srcset}" alt="{$xf.options.boardTitle}"
width="{{ property('publicLogoWidth') ?: '' }}" height="{{ property('publicLogoHeight') ?: '' }}" />
to
<img src="{{ base_url(('styles/default/images/logo-' . rand(1,5) . '.png')) }}" srcset="{$srcset}" alt="{$xf.options.boardTitle}"
width="{{ property('publicLogoWidth') ?: '' }}" height="{{ property('publicLogoHeight') ?: '' }}" />

I'm not 100% sure as I've not used XF for awhile.
 
Back
Top Bottom