I was able to get some help earlier today, but I didn't have everything from the original script for it to work. Basically I have a list of image file names in a .txt file. They each load in a slideshow, and change with the pagination on the page.
What I would like to do, is if I have a file that has a .mov extension, for example, the php script will load a movie player instead.
Here is the original slideshow script
<div id='jessslide'>
<?php
echo"
<div id='slider-wrapper'>
<div id='slider' class='nivoSlider'>";
$photos = file("work.txt");
foreach ($photos as $image) {
$item = explode("|", $image);
if ($item[0] == $fields[0]) {
$photo = trim($item[1]);
echo"<img src='images/work/$photo' alt='' />
";
}
}
echo"
</div></div>"
?>
</div>
And here is my bad attempt at trying to make this work...
<div id='jessslide'>
<?php
$photos = file("work.txt");
$img = array('jpg', 'png', 'gif');
$vid = array('swf', 'mp4', 'mov', 'mpg', 'flv');
foreach ($photos as $image) {
$item = explode("|", $image);
if ($item[0] == $fields[0]) {
$photo = trim($item[1]);
$ext = explode(".", $image);
if (in_array($ext[1], $img))
{
echo "<div id='slider-wrapper'><div id='slider' class='nivoSlider'><img src='images/work/$photo' alt='' /> </div></div>";
}
elseif (in_array($ext[1], $vid))
{
echo "<iframe src='$photo' width='800' height='450' frameborder='0' webkitAllowFullScreen allowFullScreen></iframe>";
}
}
}
?>
</div>
I would really appreciate if someone could help me out to finally bring this script to life! :)