I am trying to find the best way to go about making a server-side slide-show, where the program will get pictures from a folder called /inviteuploads, and display the contents of that folder in the slideshow (the folder will only contain images). I would be happy to use Javascript, HTML, PHP, or anything else you suggest. Maybe this isn't even possible, but please let me know!
Also i saw this post: How to create dynamic video/slideshow from pictures in PHP
But that didn't really answer my question, i need to get the uploads from the folder and have them displayed in the slideshow. Also, i dont only want to use php, i am open to any other suggested languages.
Thanks!
Code is in asp.net...jquery library is required for animation
I am using pagemethods property of scriptmanager to access images present in folder "inviteuploads" and then displaying them in a div container...return value will contain location of the images seperated by "\u000d"...i am using fadin and fadeout effects..you can use any effects of your choice :)
see the code below:
Server Side Code
[System.Web.Script.Services.ScriptMethod, System.Web.Services.WebMethod]
public static string slideshow()
{
string filename = string.Empty;
try
{
string[] Files = Directory.GetFiles(HttpContext.Current.Server.MapPath("inviteuploads"));
for (int i = 0; i < Files.Length; i++)
{
filename += "inviteupload/" + Path.GetFileName(Files[i]) + "\u000d";
}
}
catch (Exception ex)
{
}
return filename;
}
Client Side Code
function slideshow() {
PageMethods.slideshow(successslideshow, failureslideshow);
function successslideshow(msg) {
var arr = msg.split("\u000d");
var i = 0;
for (j = 0; j < (arr.length - 1); j++) {
$("#divslideshow").append("<img id=imgslideshow_" + j + " src=" + arr[j] + " width=700px height=700px style='display:none; max-height: 700px; max-width: 700px;' />");
}
$("#imgslideshow_" + i).fadeIn();
setInterval(function () {
$("#imgslideshow_" + i).fadeOut(function () {
i++;
if (i <= (arr.length - 2)) {
$("#imgslideshow_" + i).fadeIn();
}
else {
i = 0;
$("#imgslideshow_" + i).fadeIn();
}
});
}, 6000);
}
function failureslideshow(msg) {
}
}