Skip to content

Instantly share code, notes, and snippets.

@ricardosiri68
Created October 15, 2013 05:15
Show Gist options
  • Save ricardosiri68/6986828 to your computer and use it in GitHub Desktop.
Save ricardosiri68/6986828 to your computer and use it in GitHub Desktop.
biblio.php
<?
class XMLListImages{
private $siteUrl = "http://www.yosoydeolavarria.com.ar/galclub/gran";
private $extensions = array(
'JPEG', 'jpeg',
'JPG', 'jpg',
'PNG', 'png',
'BMP', 'bmp'
);
public function __construct($folderPath)
{
$this -> images = opendir($folderPath);
$this -> folderPath = $folderPath;
}
private function readFolder()
{
$files = array();
while($file = readdir($this -> images)){
$f = pathinfo($file);
if(in_array($f['extension'],$this -> extensions)){
array_push($files,$f);
}
}
return $files;
}
private function makeUrl($basename)
{
return $this -> siteUrl."/".$basename;
}
public function makeXml()
{
header("Content-Type: text/xml");
?>
<tiltviewergallery>
<photos>
<? foreach($this -> readFolder() as $f): ?>
<photo imageurl=<?="'".$this -> makeUrl($f['basename'])."'"?> showFlipButton="false" ></photo>
<? endforeach; ?>
</photos>
</tiltviewergallery>
<?}
}
// images es el directorio de donde esta leyendo las imagenes
// en tu caso tendrias que jugar con ese varlo para que apunte
// a el directorio donde tenes todas las imagenes
// una vez hecho esto solo tenes que reemplazar gallery.xml
// por este archivo ( con extension PHP obviamente ) en el script
// que se ejecuta en esta direccion
// http://www.yosoydeolavarria.com.ar/3D/aereas
// BUSCA ESTA LINEA:
// fo.addVariable("xmlURL", "gallery.xml?1.0.2");
// Y REEMPLAZALA POR ESTA
// fo.addVariable("xmlURL", "nombre de este archivo");
// y listorti
$folder = "../galclub/gran"; // < --- ese es la ruta que tenes que reemplazar
$xmlListImages = new XMLListImages($folder);
$xmlListImages -> makeXml();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment