From c54dcf670a6ea58d885eb143c0eac8d90d3020f7 Mon Sep 17 00:00:00 2001 From: Andreas Unterkircher Date: Sat, 9 Jun 2007 07:08:46 +0000 Subject: [PATCH] additional resolution for bubble images image viewer class now uses parents thumbnail handling functions git-svn-id: file:///var/lib/svn/phpfspot/trunk@68 fa6a889d-dae6-447d-9e79-4ba9a3039384 --- gen_thumbs.php | 2 +- phpfspot.class.php | 21 ++++++++++++++++----- phpfspot_cfg.php | 2 +- phpfspot_img.php | 5 +---- 4 files changed, 19 insertions(+), 11 deletions(-) diff --git a/gen_thumbs.php b/gen_thumbs.php index 1912a54..46c10d7 100755 --- a/gen_thumbs.php +++ b/gen_thumbs.php @@ -4,6 +4,6 @@ require_once "phpfspot.class.php"; $fspot = new PHPFSPOT; -$fspot->gen_thumbs('fromcmd'); +$fspot->gen_thumbs(0, 'fromcmd'); ?> diff --git a/phpfspot.class.php b/phpfspot.class.php index 948a87e..e0fba5f 100644 --- a/phpfspot.class.php +++ b/phpfspot.class.php @@ -262,7 +262,7 @@ class PHPFSPOT { $details = $this->get_photo_details($photo); - $image_url = "phpfspot_img.php?idx=". $photo ."&width=200"; + $image_url = "phpfspot_img.php?idx=". $photo ."&width=". $this->cfg->bubble_width; $filesize = filesize($this->translate_path($details['directory_path']) ."/". $details['name']); $filesize = rand($filesize/1024, 2); @@ -360,10 +360,15 @@ class PHPFSPOT { } // check_config_table - public function gen_thumbs($fromcmd = 0) + public function gen_thumbs($idx = 0, $fromcmd = 0) { - /* get all available photos */ - $all = $this->getAllTagPhotos(); + if(!$idx) { + /* get all available photos */ + $all = $this->getAllTagPhotos(); + } + else + $all = Array($idx); + foreach($all as $photo) { $full_path = $this->translate_path($details['directory_path']) ."/". $details['name']; @@ -381,8 +386,14 @@ class PHPFSPOT { /* set the new/changed MD5 sum for the current photo */ $this->setMD5($photo, $file_md5); + $resolutions = Array( + $this->cfg->thumb_width, + $this->cfg->bubble_width, + $this->cfg->photo_width + ); + /* create thumbnails for the requested resolutions */ - foreach(Array($this->cfg->thumb_width, $this->cfg->photo_width) as $resolution) { + foreach($resolutions as $resolution) { if($fromcmd) print " ". $resolution ."px"; $this->create_thumbnail($full_path, $resolution); } diff --git a/phpfspot_cfg.php b/phpfspot_cfg.php index ee05eac..34257cd 100644 --- a/phpfspot_cfg.php +++ b/phpfspot_cfg.php @@ -12,7 +12,7 @@ class PHPFSPOT_CFG { var $web_path = "/phpfspot"; var $thumb_width = "150"; - + var $bubble_width = "200"; var $photo_width = "640"; var $fspot_db = "/var/www/images.netshadow.at/htdocs/phpfspot/photos.db"; diff --git a/phpfspot_img.php b/phpfspot_img.php index 4bafa42..e2e0325 100644 --- a/phpfspot_img.php +++ b/phpfspot_img.php @@ -22,10 +22,7 @@ class PHPFSPOT_IMG { public function show($idx, $width = "") { - $details = $this->parent->get_photo_details($idx); - - foreach(Array($this->parent->cfg->thumb_width, $this->parent->cfg->photo_width) as $resolution) - $this->parent->create_thumbnail($this->parent->translate_path($details['directory_path']) ."/". $details['name'], $resolution); + $this->parent->gen_thumbs($idx); if($width == "") $fullpath = $this->parent->translate_path($details['directory_path']) ."/". $details['name']; -- 2.17.1