via PayPal / credit card
Vanilla 1.1.10 is a product of Lussumo. More Information: Documentation, Community Support.
Hello. Im using version 1.0. Is there a way to tell Monoslideshow to automatically read images from a specific directory without defining every thumbnail and image in an xml?
The only way I know to achieve this is to have some PHP script writing your xml on the fly.
Christoph
<?php
/**
* This script generates a slideshow for use in conjunction with monoslideshow 1.x
* This script is provided as-is for the moment and has not been generalised for
* easy adoption.
*/
header("Content-Type: Application/xml;"); echo "<"."?xml version=\"1.0\" encoding=\"utf-8\"?".">"; ?>
<slideshow>
<preferences/>
<album imagePath="/tk.c/splashes/" thumbnailPath="/tk.c/splashes/thumbs/">
<?php
// You might want to set this to the
// name of the folder where the images are
// relative to this script
// you must create a directory called
// "thumbs" inside there.
$path = "splashes";
if($h = opendir($path)) {
while(false !== ($file = readdir($h))) {
if(strtolower(substr($file,-4)) == ".jpg" && substr($file,0,1) != ".") {
echo "<img src=\"".$file."\" thumbnail=\"".$file."\" />n";
PutThumbs($file,$path);
}
}
} else {
die("Could not open images/banners");
}
?>
</album>
</slideshow>
<?php
function PutThumbs($file,$path) {
try {
if(!file_exists($path."/".$file)) return false;
$thumb = $path."/thumbs/".$file;
if(file_exists($thumb)) {
if(fileatime($thumb) > fileatime($path."/".$file)) return true;
}
$tn = imagecreatetruecolor(100, 50);
$source = imagecreatefromjpeg($path."/".$file);
// The last two numbers are the sizes of the
// original images. The 4th and 3rd last are
// the new sizes for the thumbs
imagecopyresampled($tn, $source, 0, 0, 0, 0, 100, 50, 1024, 532);
imagejpeg($tn,$thumb);
imagedestroy($tn);
}
catch(Exception $e) {
var_dump($e); // debug
die(); // debug
return false;
}
}
?>
1 to 3 of 3