SSI Random Image: Modern Alternatives

SSI Random Image used Server Side Includes for image rotation. Today, JavaScript handles this client-side with better performance and features.

Image Rotation

JavaScript Image Rotation

Native JavaScript Solution

Simple, dependency-free image rotation. Works in all browsers, no server processing needed.

const images = [
  '/images/banner1.jpg',
  '/images/banner2.jpg',
  '/images/banner3.jpg'
];

const img = document.getElementById('rotating-image');
let current = 0;

function rotateImage() {
  current = (current + 1) % images.length;
  img.src = images[current];
}

// Rotate every 5 seconds
setInterval(rotateImage, 5000);
Free No dependencies ~200 bytes
CSS-Only Image Rotation

Pure CSS animation for image rotation. No JavaScript needed, uses keyframes animation.

@keyframes imageRotate {
  0%, 33% { opacity: 1; }
  34%, 100% { opacity: 0; }
}

.rotating-images img {
  position: absolute;
  animation: imageRotate 15s infinite;
}

.rotating-images img:nth-child(2) { animation-delay: 5s; }
.rotating-images img:nth-child(3) { animation-delay: 10s; }
Free No JS CSS only

Modern Carousel Libraries

Swiper

Most popular modern slider. Touch-enabled, responsive, works with React, Vue, Angular.

Free MIT License All frameworks
Splide

Lightweight, accessible slider. No dependencies, excellent documentation.

Free MIT License ~29KB
Flickity

Touch, responsive, flickable carousels. Physics-based animations, free for personal use.

Free (personal) Commercial: $25 Physics-based

SSI vs JavaScript

Feature SSI Script JavaScript
Server processingRequiredNone
Real-time rotationPage refreshAutomatic
TransitionsNoneCSS/JS effects
File extension.shtml requiredAny
Server configSSI enabledNot needed
CachingComplexSimple
PerformanceServer loadClient-side

Recommendation

Simple rotation: Native JavaScript

No JS needed: CSS animation

Full features: Swiper

Lightweight: Splide

Why SSI is Obsolete

  • Server processing overhead
  • Requires .shtml extension
  • No real-time updates
  • Complex caching
  • JavaScript is faster
All Examples SSI Image Overview