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

album_gallery.php

Go to the documentation of this file.
00001 <?php
00002 /* $Id: album_gallery.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  */
00036 class Album_gallery extends Album
00037 {
00043         function loadData($dir)
00044         {
00045                 // We need for photos location of Gallery...
00046                 global $settings;
00047 
00048                 require_once ($settings->attribute("gallery_location")."/classes/Image.php");
00049                 require_once ($settings->attribute("gallery_location")."/classes/AlbumItem.php");
00050 
00051                 $albumsrc = $dir."/album.dat";
00052                 $photosrc = $dir."/photos.dat";
00053                 
00054                 if (!file_exists($albumsrc) || !file_exists($photosrc))
00055                 {
00056                         return;
00057                 }
00058                 
00059                 // Load serialized data...
00060                 ob_start();
00061                 readfile($albumsrc);
00062                 $aser = ob_get_contents();
00063                 ob_end_clean();
00064 
00065                 ob_start();
00066                 readfile($photosrc);
00067                 $pser = ob_get_contents();
00068                 ob_end_clean();
00069                 
00070                 $data = unserialize($aser);
00071                 $photos = unserialize($pser);
00072                 
00073                 // Support only version 10
00074                 if ($data->version != 10)
00075                 {
00076                         return;
00077                 }
00078                 // Load data...
00079                 $this->id = $data->fields['name'];
00080                 $this->attributes['title'] = $data->fields['title'];
00081                 $this->attributes['description'] = $data->fields['description'];
00082                 $this->attributes['visited'] = $data->fields['clicks_date'].":".$data->fields['clicks'];
00083                 $this->attributes['comments'] = "gallery://$dir";
00084 
00085                 // Find photos...
00086                 for ($p = 0; $p < count($photos); $p++)
00087                 {
00088                         // We support only version 10!
00089                         if ($photos[$p]->version != 10)
00090                         {
00091                                 continue;
00092                         }
00093                         $tmp = $photos[$p]->image;
00094                         if ($tmp->name != null)
00095                         {
00096                                 if (!is_null($tmp->resizedName))
00097                                 {
00098                                         $this->photos[] = $tmp->resizedName.".".$tmp->type;
00099                                 }
00100                                 else
00101                                 {
00102                                         $this->photos[] = $tmp->name.".".$tmp->type;
00103                                 }
00104                                 $this->thumbnails[] = $tmp->name.".thumb.".$tmp->type;
00105                                 $this->captions[] = $photos[$p]->caption;
00106                                 $this->visited[] = $photos[$p]->uploadDate.":".$photos[$p]->clicks;
00107                         }
00108                 }
00109                 
00110                 // Find logo...
00111                 foreach ($photos as $photo)
00112                 {
00113                         if ($photo->highlight)
00114                         {
00115                                 $this->attributes['logo'] = $photo->highlightImage->name.".".$photo->highlightImage->type;
00116                                 break;
00117                         }
00118                 }
00119         }
00120 }
00121 ?>

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