Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages  

album_xml.php

Go to the documentation of this file.
00001 <?php
00002 /* $Id: album_xml.php,v 1.2 2003/10/03 15:28:41 mikko Exp $ */
00003 /*
00004  * ImaComm - a web based photo album software
00005  * Copyright (C) 2003, Mikko Kokkonen
00006  *
00007  * This program is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 2 of the License, or (at
00010  * your option) any later version.
00011  * 
00012  * This program is distributed in the hope that it will be useful, but
00013  * WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * General Public License for more details.
00016  * 
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00020  */
00031 class Album_XML extends Album
00032 {
00037         function loadData($file)
00038         {
00042                 global $settings;
00043                 
00044                 if (is_null($this->minixml))
00045                 {
00046                         $this->minixml = $settings->attribute("minixml_path");
00047                 }
00048                 require_once ($this->minixml."/minixml.inc.php");
00049 
00050                 $doc = new MiniXMLDoc();
00051                 $doc->fromFile($file);
00052                 $root =& $doc->getRoot();
00053 
00054                 $album =& $root->getElement("album");
00055                 $this->id = trim($album->attribute("id"));
00056 
00057                 // And photos...
00058                 for ($c = 0; $c < $album->numChildren(); $c++)
00059                 {
00060                         $child =& $album->xchildren[$c];
00061 
00062                         if ($child->name() != "photo")
00063                         {
00064                                 $this->attributes[$child->name()] = trim($child->text());
00065                         }
00066                         else
00067                         {
00068                                 $photo = trim($child->text());
00069                                 $this->photos[] = $photo;
00070                                 $this->captions[] = trim($child->attribute("caption"));
00071                                 // Do we have sized photo?
00072                                 if (preg_match('/\.sized\./', $photo))
00073                                 {
00074                                         $this->thumbnails[] = preg_replace('/sized/', 'thumb', $photo);
00075                                 }
00076                                 else
00077                                 {
00078                                         $pi = pathinfo($photo);
00079                                         $s = array('/\.'.$pi['extension'].'/');
00080                                         $r = array(".thumb.".$pi['extension']);
00081                                         $thumb = preg_replace($s, $r, $pi['basename']);
00082                                         $this->thumbnails[] = $thumb;
00083                                 }
00084                         }
00085                 }
00086         }
00087 }
00088 ?>

Generated on Sun Oct 19 11:08:00 2003 for ImaComm by doxygen1.3