Jump to content

Slideshow stopped working


muppet77

Recommended Posts

Hi all. 
I have a script that takes some photos from files that are organised by date and hour and minute on my hosting site and then rotates through them displaying them in turn. 
 

It used to work fine about a week ago until I renewed my SSL certificate. No idea if this is to do with it..? 

Now the script shows one photo and then goes blank and then displays a message - “can’t open this page. ” 

Any ideas? 
Thank you  

<?php 

date_default_timezone_set('Europe/London');
$date = date("Y-m-d");


$dir = './5L096B7PAG30CB5/'.$date.'/001/jpg/'; 


$imagesList = array();
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($dir)) as $filename) {
    if ($filename->isDir()) continue;
    $imagesList[] = str_replace("\\","/",$filename->getPathname());
}
//print_r($imagesList);

$numberimages = count($imagesList);


echo $numberimages; 

?>

 
<html lang="en">
<head>
<title>cam</title>

<style>
body {font-family:Arial, Helvetica, sans-serif; font-size:12px;}

.fadein { 
position:relative; height:90%; width:90%; margin:0 auto;

padding: 10px;
 }
.fadein img{
	position:absolute;
	width: calc(100%);
    height: calc(100%);
    object-fit: scale-down;
}
</style>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script>
$(function(){ 
	$('.fadein img:gt(0)').hide(); 
	setInterval(function(){$('.fadein :first-child').fadeOut().next('img').fadeIn().end().appendTo('.fadein');  }, 111);
});
</script>

</head>
<body>
<div class="fadein">

<?php 


//$scan_dir = scandir($dir);
foreach($imagesList as $img):
	if(in_array($img,array('.','..')))
	continue; 

?>

<img src="<?php echo $img ?>" alt="<?php echo $img ?>"> 


<?php  


endforeach; 

?> 
</div> 
</body> 
</html>



<?php
// clear all folder older than x days


$days = 0.5;  
$dir = './5L096B7PAG30CB5/';

$now   = time();
$dir = new \RecursiveDirectoryIterator($dir, \FilesystemIterator::SKIP_DOTS);
$dir = new \RecursiveIteratorIterator($dir,\RecursiveIteratorIterator::CHILD_FIRST);
$deleteFiles =[];
$message = "There is no file to delete";
if($dir) {
    foreach ($dir as $file) {
       /* Comparing the current time with the time when file was created */
        if ($file && $now - filemtime($file) >= 60 * 60 * 24 * $days) { //  days
            array_push($deleteFiles, $file);
            $file->isDir() ? rmdir($file) : unlink($file);
            $message = "All the following files are deleted.<br/>";
        } 
    }
}else {
    
}

?>

 

Edited by muppet77
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.