Am I missing a smart way to create Data.xml?

Dec 16, 2007 at 5:58 PM
Hello all,

Is there a way to create Data.xml from folders and files that are on the site or a way to feed folders and files on the site automatically to the slideshow without the need for a Data.xml?

Thanks,
Avram
Dec 17, 2007 at 1:37 AM
what is your server running? I've written a very simple ASP.NET page that builds the Data.XML on-demand (at the moment it doesn't do thumbnails or create descriptions for you - that's easy enough to edit later)
Happy to post that.
I wanted to get it (optionally) picking up thumbnails, respecting existing descriptions etc in the file (if you're refreshing the list) and maybe work out how to get meta data out of .jpg images... but don't have the time right now.
Happy to share if that would help...
Dec 18, 2007 at 8:16 PM
Oh that would be great! I'm just starting to get into creating websites and all that but I am a programmer so I can probably try to make sense of the code you post and maybe modify it to suite my needs...

Thanks,
Avram
Dec 18, 2007 at 8:46 PM
What would be great is if you could provide the sildeshow pluging a relative path and filename wildcard in the data.xml album sections and have it parse that path for hits and generate the album from that. This way the auto album generation routines would work on free hosting services like office.live.com basics where asp.net page processing is not supported.
Dec 19, 2007 at 2:01 AM
@avrmw - I'm on the road the rest of the week, but I'll try and tidy up and post the ASP script if I can

@robertob - if you can't run server side scripts then how would you get the directory listing? Javascript is client side and can't parse the server anyway... it would need some sort of server side processing to get that data...
Jan 2, 2008 at 7:01 PM
Edited Jan 8, 2008 at 2:31 PM
I have written a DotNetNuke module which does all the data file management nicely, resamples and thumbnails images for viewer client size, stores images in filesystem or database, and more, all for $17.95 right now:

http://www.snowcovered.com/Snowcovered2/Default.aspx?r=f980178d13&tabid=242&PackageID=9308

Thanks for a great project.
Jan 8, 2008 at 9:32 AM
I'd love to receive that script aswell.
This open source project looks great and I would love to be able to have it load images from a directory without the need of a data.xml file.
It would also be cool if it were possible that it refreshes automatically when a new image is uploaded without having to refresh the slideshow page manually.

Any ideas on this would be welcome here or in my emailbox :)

Thanks in advance.
Developer
Jan 8, 2008 at 10:59 PM
Its fairly easy to create an .ashx that can traverse whatever datasource you want (file folders, database, whatever) and generate the appropriate XML that matches the Data.xml format. Just point your configuration.xml dataprovider to your custom .ashx.
Mar 5, 2008 at 2:23 AM

kennster wrote:
I have written a DotNetNuke module which does all the data file management nicely, resamples and thumbnails images for viewer client size, stores images in filesystem or database, and more, all for $17.95 right now:

http://www.snowcovered.com/Snowcovered2/Default.aspx?r=f980178d13&tabid=242&PackageID=9308

Thanks for a great project.


What the heck is this? Your on an open source project. Why can't you just recontribute back to the project. Thanks for not contributing, but trying to make money off something that is already open source. I suggest you not use this site if you are going to charge for your work.
Mar 5, 2008 at 3:40 AM


cheetahtech wrote:

kennster wrote:
I have written a DotNetNuke module which does all the data file management nicely, resamples and thumbnails images for viewer client size, stores images in filesystem or database, and more, all for $17.95 right now:

http://www.snowcovered.com/Snowcovered2/Default.aspx?r=f980178d13&tabid=242&PackageID=9308

Thanks for a great project.


What the heck is this? Your on an open source project. Why can't you just recontribute back to the project. Thanks for not contributing, but trying to make money off something that is already open source. I suggest you not use this site if you are going to charge for your work.


Hi cheetahtech:

For your information, this project is released under a license which ENCOROUGES SUCH USE. Read the license if you have any questions. I'd say the 100+ hours I have invested in the module is a veritable bargain for you to purchase at $80.00? If you disagree, you don't have to buy it? I can also say I have contributed TONS back to the Open Source community in my investment in DotNetNuke Modules. I freely gave away a full featured ecommerce module, a fully featured Document Mangement System and more from my web site for over three years.

But times change my friend. I lost my 18 month old daughter to cancer about two years ago after an 11 month long battle, and even though she was insured through the whole process, I somehow still owe over $50,000.00 in medical bills?

So, thanks for your input, fortunately, I have plenty of customers who also live in the real world and are happy to pay the $20-$30.00 I charge for my modules!

Sincerely,
Kenneth S. Courtney
http://aciasoftware.com

My profile page on Snowcovered.com:
http://www.snowcovered.com/snowcovered2/Default.aspx?tabid=241&sid=6689&r=f980178d13

Natalie Kay Courtney's Memorial Site: http://natalie.aciasoftware.com
Mar 12, 2008 at 5:25 PM
@OffBeatMammal

I would also be interested in such an ASP.net script to assist in generating the data.xml file. Unfortunately it looks like you haven't been back since offering it.
Apr 12, 2008 at 2:42 AM
Edited Apr 12, 2008 at 6:19 PM
I'm also looking for such a script.

By the way, can we replace the .aspx script by a php script ? (I'm a newbie in js)
Something like :

Each file works well separately. But together... nothing....

Do you have a clue ?


in SlideShow.php
<?php
$titre = $_GET'titre';
$rep = $_GET'rep';
?>

<html>
<head>
<title><? echo "$titre" ?></title>
<script type="text/javascript" src="Silverlight.js"></script>
<script type="text/javascript" src="SlideShow.js"></script>
</head>
<body>
<script type="text/javascript"> new SlideShow.Control(new SlideShow.XmlConfigProvider({ url: <? echo "getConfiguration.php?titre="."$titre"."&rep="."$rep"; ?> } ));
</script>
</body>
</html>

in getConfiguration.php
<configuration width="600" height="500" background="Silver">
<modules>
<module type="SlideViewer" />
<module type="ProgressBar" />
<module type="SlideDescription" />
<module type="NavigationTray">
<option name="thumbnailViewer.left" value="83" />
<option name="toggleAlbumViewButton.visibility" value="Collapsed"/>
<option name="slideShowNavigation.playTimerInterval" value="1000" />
<option name="slideShowNavigation.loopAlbum" value="true" />
</module>
</modules>
<transitions>
<transition type="FadeTransition" name="CrossFadeTransition" />
<transition type="WipeTransition" name="WipeRightTransition">
<option name="direction" value="Right" />
</transition>
</transitions>
<dataProvider type="XmlDataProvider" />
<option name="url" value="<?php echo "getData.php?titre=".$GET'titre'."&rep=".$GET'rep' ?>" />
</dataProvider>
</configuration>

in getData.php
<?php
// rep est le repertoire contenant
$rep = $_GET'rep';
$titre = $_GET'titre';
$des = "by Erwan Ermel (c)";

function GetFileList( $dirname )
{

$arg=funcgetargs();
// Finds all the JPEGs in a directory
$files = array();
$dir = opendir( $dirname );

while($file = readdir( $dir ))
{
if(ereg("jpg$",$file) || ereg("JPG$",$file) || ereg("jpeg$",$file) || ereg("JPEG$",$file))
$files[] = $file;
} //do while
sort($files);
return $files;
} //end function
?>

<data transition="CrossFadeTransition">
<album
title="<? echo $_GET'titre'; ?>"
description="<? echo $_GET'titre'; ?>"
image="">

<?
$repertoire = "../../photos/".$rep."/img/";
$imagelist = GetFileList($repertoire);
$nbimg = sizeof($imagelist);
$j=1;

while ( list($i,$image) = each ($imagelist) )
{
?>
<slide title="<? echo "$image"; ?>" description="<? echo "$des"; ?>" image="<? echo "$repertoire"."$image"; ?>" />
<?
$j++;
} // do while
?>
</album>
</data>
Apr 22, 2008 at 3:56 AM
my little ASP execution that generated data.xml for you by traversing subdirectories can be downloaded from http://blog.offbeatmammal.com/samples/slprepdata.aspx.src

You need to make sure it has write access to data.xml and then run it from the parent directory of the albums
It's not had much testing - worked on my Windows Home Server :) and it's really not "production" quality of any sort (but hey, it got the job done!)

<%@ Page Trace="False" Language="vb" aspcompat="false" debug="true" validateRequest="false"%>
<%@ Import Namespace=System.IO %>
<SCRIPT LANGUAGE="VBScript" runat="server">

Dim strThisPage ' This page's relative URL
Dim strPath ' Path of directory to show
Dim strFullPath ' strRootPath & strPath
Dim objFSO ' FileSystemObject
Dim objFolder ' Folder
Dim objItem ' Looping variable

dim outXML

function getPhotos(dirName, path)
dim isAlbum
isAlbum = false
response.write("Scanning directory " & dirName & "<br>")
For Each objItem In path.Files
select case lcase(right(objItem.name,3))
case "jpg", "png"
if not isAlbum then
outXML += "<album title=""" & dirName & """ description = """">" & vbCrLf
isAlbum = True
end if
outXML += "<slide title=""" & left(objItem.name,len(objItem.name)-4) & """ description = """" image=""images/" & dirName & "/" & objItem.name & """/>" & vbCrLf
end select
Next
if isAlbum
outXML += "</album>" & vbCrLf
end if
end function

Public Function SaveTextToFile(ByVal strData As String, _
ByVal FullPath As String, _
Optional ByVal ErrInfo As String = "") As Boolean

Dim Contents As String
Dim bAns As Boolean = False
Dim objReader As StreamWriter
Try
objReader = New StreamWriter(FullPath)
objReader.Write(strData)
objReader.Close()
bAns = True
Catch Ex As Exception
ErrInfo = Ex.Message

End Try
Return bAns
End Function
</script>
<html>
<head>
<title>Prepare Data.XML for Slide.Show</title>
</head>
<body>
<p>Getting data</p>
<%

outXML = "<?xml version=""1.0"" encoding=""utf-8"" ?>" & vbCrLf
outXML += "<data transition=""CrossFadeTransition"">" & vbCrLf

strFullPath = "images\"
response.write("Using directory " & Server.MapPath(strFullPath) & "<br>")


' Create our FSO and get a handle on our folder
objFSO = Server.CreateObject("Scripting.FileSystemObject")
objFolder = objFSO.GetFolder(Server.MapPath(strFullPath))

getPhotos("Default",objFolder)

For Each objItem In objFolder.SubFolders
getPhotos(objItem.Name, objItem)
Next

outXML += "</data>"

objItem = Nothing
objFolder = Nothing
objFSO = Nothing

SaveTextToFile(outXML, server.mappath("." & "/data.xml"))
%>
<p>Done!</p>
</body>
</html>