A portable, self-contained PHP/JavaScript image carousel for displaying client logos
The carousel is completely self-contained and portable. To install on any PHP-enabled web server:
/logos/)image-carousel.php into that directoryimage-carousel.php (optional).svg files in its directory and creates the carousel. No build step, no dependencies, no database.
/your-website/logos/
image-carousel.php # The carousel script
client-a.svg # Your logo files
client-b.svg
client-c.svg
...
Edit the parameters at the top of image-carousel.php to customize behavior:
<?php
/*
* Image Carousel - Configurable Parameters
*/
// Number of logos to display in the carousel
$logoCount = 6;
// Slider rotation interval in milliseconds
// (how long each "page" shows before auto-advancing)
$rotateInterval = 15000; // 15 seconds
// Logo shuffle interval in seconds
// (how often the random selection changes for all users)
$shuffleInterval = 300; // 5 minutes
// Optional: Link URL - if set, clicking any logo navigates to this URL
// Leave empty string '' to disable links
$linkUrl = '';
// Link target: true = open in new tab/window, false = open in same tab
$linkNewTab = true;
| Parameter | Default | Description |
|---|---|---|
$logoCount |
6 | Maximum number of logos to include in the carousel. Logos are randomly selected from available SVGs. |
$rotateInterval |
15000 | Time in milliseconds before auto-advancing to the next page (only in slider mode). |
$shuffleInterval |
300 | Time in seconds before selecting a new random set of logos. All visitors see the same logos during each interval. |
$linkUrl |
'' (empty) | URL to navigate to when any logo is clicked. Leave empty to disable click behavior. |
$linkNewTab |
true | If true, links open in a new tab/window. If false, links open in the same tab. |
Add the carousel to any HTML page using a script tag:
The carousel automatically inserts itself at the script location:
<script src="/logos/image-carousel.php"></script>
Control exactly where the carousel appears:
<div id="logo-carousel"></div>
<script src="/logos/image-carousel.php"></script>
To force browsers to reload the carousel after changes:
<!-- PHP -->
<script src="/logos/image-carousel.php?v=<?php echo time(); ?>"></script>
<!-- Static HTML (update manually) -->
<script src="/logos/image-carousel.php?v=2"></script>
Fine-tune the carousel appearance with CSS custom properties:
#logo-carousel {
--logo-carousel-height: 80px; /* Logo container height (default: 80px) */
--logo-carousel-padding: 20px; /* Vertical padding (default: 20px) */
--logo-carousel-gap: 40px; /* Space between logos (default: 40px) */
}
#logo-carousel {
--logo-carousel-height: 120px;
--logo-carousel-padding: 40px;
}
#logo-carousel {
--logo-carousel-height: 50px;
--logo-carousel-padding: 10px;
--logo-carousel-gap: 20px;
}
.svg filesFor best results, your SVG logos should:
acme-corp.svg) as the filenames may be used for organization and debugging.
viewBox instead of fixed width/height