Topic: php dynamic?
Is it possible to make the PostcardViewer dynamic?
If an image is added to the image folder can it automatically be added to the gallery using php?
Is it possible? Has anyone done this?
You are not logged in. Please login or register.
SimpleViewer Forum → PostcardViewer → php dynamic?
Is it possible to make the PostcardViewer dynamic?
If an image is added to the image folder can it automatically be added to the gallery using php?
Is it possible? Has anyone done this?
Hi JMX Id also be interested in seeing if this is possible.
I would be willing to do away with the tags/ text if the script could search a folder
and generate image thumbnails automatically...
Yes, it is possible to use php to dynamically create a PostcardViewer album.
Put the following code in a file named 'gallery.php':
<?php
function GetDirArray($folder)
{
$handle=opendir($folder);
while ($file=readdir($handle))
{
if ($file!="." && $file!="..")
{
$ret[count($ret)]=$file;
}
}
closedir($handle);
sort($ret);
return $ret;
}
$gallery=GetDirArray('images');
echo '<?xml version="1.0" encoding="UTF-8"?>';
echo '<gallery cellDimension="800" columns="5" zoomOutPerc="15" zoomInPerc="100" frameWidth="20" frameColor="0xFFFFFF" captionColor="0xFFFFFF" enableRightClickOpen="true">';
for ($i=0; $i<sizeof($gallery); $i++)
{
echo '<image><name>images/'.$gallery[$i].'</name><caption></caption></image>';
}
echo '</gallery>';
?>
... and use the following line in your embedding code:
fo.addVariable("xmlURL", "gallery.php");
You may wish to change the gallery settings to suit your needs and the above code assumes that your images are in a folder named 'images' .
Here it is in action: http://testgallery.110mb.com/pvphp/index.html
SimpleViewer Forum → PostcardViewer → php dynamic?
Powered by PunBB, supported by Informer Technologies, Inc.
Currently installed 5 official extensions. Copyright © 2003–2009 PunBB.