Jump to content

Playing all images from folder, with pause in between


TheDutchBeast

Recommended Posts

Hello follow programmers, I have a little question regarding my PHP code.

I now have a perfect working code that takes my frame heigth and width and adjusts the image to the frame. Works great.

 

The issue now is, I have multiple images in my dolder, how can I play them with a delay of say.. 10 seconds?

Here is the piecer of my code that matters: Of course I have to count the images in the folder but how do I play them with a short break in it.

 

<?php
 $img_folder = "../fotos/";
 $imgs = dir($img_folder);
 while ($file = $imgs->read()) {
	 $lengte = (strlen($file)-3);
	 $extentie = substr($file,$lengte,3);
	 //print "extentie $lengte = $extentie <br>";
	 if($extentie == "jpg" || $extentie == "JPG" || $extentie =="jpeg" || $extentie =="gif" || $extentie =="bmp"){
	   //print "tada<br>";
			    $size = getimagesize($img_folder.$file);
	   $hoog = $size[1];
	   $breed = $size[0];
	   if(($breed/$screenW)>($hoog/$screenH)){
	    print"<img src=\"$img_folder$file\" width=\"$screenW\">";
	   }else{
	    print"<img src=\"$img_folder$file\" height=\"$screenH\">";
	   }
	 }
 }					 
closedir($imgs->handle);
}

?> 

 

Thanks in advance!

Dave

Link to comment
Share on other sites

Once PHP has processed your script server-side the web server sends the content to the client. Once that's happened you can't edit the content of the page with just PHP without sending another request.

 

You'll need to use Javascript to cycle through the images.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.