From: Reini U. <ru...@x-...> - 2005-09-11 19:02:26
|
Thomas Harding schrieb: > Hello, > I added thumbnails support for PhotoAlbum plugin in my installation > this weekend, and fixed few bugs. > ImageTile.php is at top-level of wiki tree. > > It's quick and dirty :) Well, too dirty for me. HtmlElement is no good place for img_tile(). The WikiUserNew PearDB patch was already applied some time ago. But I like the idea and will implement it. Thanks! > ------------------------------------------------------------------------ > > diff -rc phpwiki-1.3.11/lib/HtmlElement.php public_html/image_materiels/materiel/phpwiki/lib/HtmlElement.php > *** phpwiki-1.3.11/lib/HtmlElement.php 2005-02-12 18:08:18.000000000 +0100 > --- public_html/image_materiels/materiel/phpwiki/lib/HtmlElement.php 2005-09-11 18:34:15.945336736 +0200 > *************** > *** 184,189 **** > --- 184,207 ---- > $el = new HtmlElement('img'); > return $el->_init2(func_get_args()); > } > + function img_tile (/*...*/) { > + $el = new HTML ('img'); > + $tag = func_get_args(); > + $params = "<img src='../ImageTile.php?url=" > + .$tag[0]['src'] > + ."&width=" > + .$tag[0]['width'] > + ."&height=" > + .$tag[0]['height'] > + ."' width='" > + .$tag[0]['width'] > + ."' height='" > + .$tag[0]['height'] > + ."' alt='" > + .$tag[0]['alt'] > + ."' />"; > + return $el->raw ($params); > + } > function br (/*...*/) { > $el = new HtmlElement('br'); > return $el->_init2(func_get_args()); > diff -rc phpwiki-1.3.11/lib/plugin/PhotoAlbum.php public_html/image_materiels/materiel/phpwiki/lib/plugin/PhotoAlbum.php > *** phpwiki-1.3.11/lib/plugin/PhotoAlbum.php 2004-12-06 20:50:05.000000000 +0100 > --- public_html/image_materiels/materiel/phpwiki/lib/plugin/PhotoAlbum.php 2005-09-11 20:01:54.221957184 +0200 > *************** > *** 217,223 **** > } > > $newwidth = $this->newSize($size[0], $width); > ! $newheight = $this->newSize($size[1], $height); > > if ($width != 'auto' && $newwidth > 0) { > $params = array_merge($params, array("width" => $newwidth)); > --- 217,226 ---- > } > > $newwidth = $this->newSize($size[0], $width); > ! if ($mode == 'thumbs' || $mode == 'tiles') > ! $newheight = round (50 * $size[1] / $size[0]); > ! else > ! $newheight = $this->newSize($size[1], $height); > > if ($width != 'auto' && $newwidth > 0) { > $params = array_merge($params, array("width" => $newwidth)); > *************** > *** 246,251 **** > --- 249,255 ---- > //create url to display single larger version of image on page > $url = WikiURL($request->getPage(), > array("p" => basename($value["name"]))); > + > $b_url = WikiURL($request->getPage(), > array("h" => basename($value["name"]))). > "#". > *************** > *** 255,261 **** > basename($value["name"]); > if (! $p) { > $url_image = $link ? HTML::a(array("href" => "$url"), > ! HTML::img($params)) : > HTML::img($params); > } else { > $url_image = $link ? HTML::a(array("href" => "$b_url"), > --- 259,265 ---- > basename($value["name"]); > if (! $p) { > $url_image = $link ? HTML::a(array("href" => "$url"), > ! HTML::img_tile($params)) : > HTML::img($params); > } else { > $url_image = $link ? HTML::a(array("href" => "$b_url"), > *************** > *** 425,430 **** > --- 429,435 ---- > } > return; > } > + $src = $src_bak; > @$fp = fopen ($src, "r"); > if (!$fp) { > return $this->error(fmt("Unable to read src='%s'", $src)); > diff -rc phpwiki-1.3.11/lib/WikiUserNew.php public_html/image_materiels/materiel/phpwiki/lib/WikiUserNew.php > *** phpwiki-1.3.11/lib/WikiUserNew.php 2005-04-03 12:11:10.000000000 +0200 > --- public_html/image_materiels/materiel/phpwiki/lib/WikiUserNew.php 2005-09-09 23:40:31.000000000 +0200 > *************** > *** 1098,1103 **** > --- 1098,1105 ---- > return _AdoDbPassUser::setPreferences($prefs, $id_only); > } > elseif ($this->_prefs->_method == 'SQL') { > + include_once("lib/WikiUser/Db.php"); > + include_once("lib/WikiUser/PearDb.php"); > _PearDbPassUser::_PearDbPassUser($this->_userid, $prefs); > return _PearDbPassUser::setPreferences($prefs, $id_only); > } -- Reini Urban http://xarch.tu-graz.ac.at/home/rurban/ http://phpwiki.org/ |