I need to create a php code to show a media gallery, in which each image is shown for some seconds. In particular, the images can be PNG or GIF, and in the second case I need it to show the animation. Basically, my simple code for showing a single PNG image is the following:
<?php
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Content-type: image/png");
$imgpath = "./try.png"
$im = imagecreatefrompng($imgpath);
imagepng($im);
imagedestroy($im);
?>
First, I noticed that if I want to show a GIF image, using the functions imagecreatefromgif() and imagegif(), it only shows the first frame of the animation, and this is the first problem. Secondly, I would ask you what functions I should use if I have a folder with some images (let them be firstly just PNGs) and show them in loop with a regular time interval. The final result, then would be to make this slideshow with PNGs and GIFs in the folder, with the code showing the GIFs as animations. Thank you