Advanced search  


cpg1.5.46 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter recently discovered vulnerabilities. It is important that all users who run version cpg1.5.44 or older update to this latest version as soon as possible.

Pages: [1]   Go Down

Author Topic: Slideshow for external site  (Read 239 times)

0 Members and 1 Guest are viewing this topic.


  • Coppermine regular visitor
  • **
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 92
    • Bookmarks (Links), Grafik, Musik, Movies (Filme), DVD's, CD's, Amazon-Shop by Starmaker - Mark Tailor
Slideshow for external site
« on: August 21, 2017, 11:04:24 pm »

Hi ...

after many hours I've "created" a slideshow which can use on an external (outside of cpg) website.

Before I try to explain what I've done, take a look here (scroll down to "Gallery") to see what this all about.

Ok ...
I use SlideshowIt plugin for CPG1.6.x as base for my script (thank you to ron4mac for this plugin !) and some code I found here: Display a random image on an external website.
All this together works (in my case with cpg 1.5.46 and PHP 7) ... and YES !!! ... I'm also surprised as you are  ;D .

I've created a file called "slideshow.php" in the cpg folder with this code:
Code: [Select]
<link rel="stylesheet" href="">
// ------------------------------------------------------------------------- //
// Coppermine Photo Gallery - RSS Feed                                      //
// ------------------------------------------------------------------------- //
// Copyright (C) Dr. Tarique Sani                                           //
//                                                  //
// Adapted by djib to display a random photo -              //
// This program is free software; you can redistribute it and/or modify     //
// it under the terms of the GNU General Public License as published by     //
// the Free Software Foundation; either version 2 of the License, or        //
// (at your option) any later version.                                      //
// ------------------------------------------------------------------------- //
// Just put into the same directory as your coppermine installation         //
// ------------------------------------------------------------------------ //


//How many items you want to show in your get_photo script
if(isset($_GET['nb'])) {
} else {
$thumb_per_page 10;
$thumb_count 10;
$lower_limit 0;

$album $_GET['album'];

//If it is a numeric album get the name and set variables
if ((is_numeric($album))){
$album_name_keyword get_album_name($album);
$CURRENT_CAT_NAME $album_name_keyword['title'];
$ALBUM_SET "AND aid IN (".(int)$_GET['album'].")".$ALBUM_SET;
//Set the album to last uploaded
$album 'lastup';

//If the album is not set set it to lastup - this is the default
$album 'lastup';

//Changes these to point to your site if the following is not giving correct results.
$link_url $CONFIG['ecards_more_pic_target']."displayimage.php?pos=-";
$image_url $CONFIG['ecards_more_pic_target']."albums/";

$data get_pic_data($album$thumb_count$album_name$lower_limit$thumb_per_page);

$data AS $picture) {
$thumb_url "$image_url$picture[filepath]$picture[filename]";
$description '<a target="_parent" href="' $link_url $picture['pid'] . '"><img style="border-radius: 8px;  border: 1px solid black; width: 100%;" class="mySlides w3-animate-fading" src="' $thumb_url '"/></a>';



var myIndex = 0;
function carousel() {
    var i;
    var x = document.getElementsByClassName("mySlides");
    for (i = 0; i < x.length; i++) {
       x[i].style.display = "none"; 
    if (myIndex > x.length) {myIndex = 1}   
    x[myIndex-1].style.display = "block"; 
    setTimeout(carousel, 5000);   

Then I put this code in my index.php in my website root:
Code: [Select]
<div class="w3-content w3-section" style="background-color: none;">
<iframe  style="height: 380px; width: 500px;" src="cpg15x/slideshow.php" name="header_frame" marginheight="0" marginwidth="0" frameborder="0" scrolling="no"></iframe></div>

I don't know but maybe this is helpful for others ...


  • Coppermine regular visitor
  • **
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 92
    • Bookmarks (Links), Grafik, Musik, Movies (Filme), DVD's, CD's, Amazon-Shop by Starmaker - Mark Tailor
Re: Slideshow for external site
« Reply #1 on: August 21, 2017, 11:21:44 pm »

I forgot to mention that there could be a problem with LightBox Slideshow jquery ( v3.2. Maybe it's because of my code or lightbox ... at the moment I don't know.


  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Posts: 648
Re: Slideshow for external site
« Reply #2 on: August 22, 2017, 12:49:06 pm »

Your site is actually running CPG 1.6.03.
« Last Edit: August 22, 2017, 12:57:49 pm by ron4mac »


  • Coppermine newbie
  • Offline Offline
  • Posts: 11
Re: Slideshow for external site
« Reply #3 on: September 13, 2017, 01:12:51 am »

Word of caution
The plug in itself is brilliant and simple to set up. It was just the sort of thing I have been looking for for some considerable time.
It is using the full size images from your web site, I discovered this when I suddenly had a couple of messages from my mobile phone provider to let me know that my monthly data allowance was running low - this is very unusual for me as I dont use my data allowance that much. I logged onto my mobile phone account and checked what data I had been using and it coincided with me viewing my own website (I was checking to see how it looked on my phone elsewhere than at home where I would be using my wifi connection.)

I can alter a few things in these plug-ins by studying what it looks like the code is achieving but having said that I am not in any way profficient in PHP or W3.CSS.
Anyone out there who could perhaps tweak the code so that it fetches the image thumbnails rather than the full size images?
In the meantime I have had to disable this otherwise brilliant plug-in from my site.
Pages: [1]   Go Up

Page created in 0.015 seconds with 20 queries.