|
|
Choosing A Webhost: |
Simple new plugin 'ImageThumb'!: msg#00026web.wiki.phpwiki.talk
Hi guys, I'm new to the list (and to phpWiki.. just 3 days), but I thought I'd contribute a plugin I've just written. PROBLEM: Everywhere that a thumbnail is put in my HTML pages, I always make it click-able, so that you can see the "full-sized" version of the image easily. I couldn't figure out what combination of wiki syntax would give me a <img> tag inside a <a> tag. Ie: like <a href='...'><img src='...'></a> So I wrote a plugin that does it: <?plugin ImageThumb src="/files/thumbnail1.jpg" target="/files/fullsize1.jpg" ?> This gives you the thumbnail (in 'src') just as usual, but it's clickable, and links to the URL from 'target'. Hope this is useful to someone... And if the developers want to included this in the core of PhPWiki, go wild. Buzz. SOLUTION: ImageThumb.php --------------cut here:------------------- <?php // -*-php-*- /** Copyright 2006 David Bussenschutt, based on HelloWord code template which is Copyright 1999, 2000, 2001, 2002 $ThePhpWikiProgrammingTeam * released under the same license as PhpWiki. * great work guys! This file is NOT YET part of PhpWiki. */ /** * Display a thumbnail of an image, and make it a clickable link to the fullsized version. ( I can't believe you can't already do this in Wiki Syntax!) * * Usage: * <?plugin ImageThumb src="/files/thumbnail1.jpg" target="/files/fullsize1.jpg" ?> */ // Constants are defined before the class. if (!defined('THE_END')) define('THE_END', "!"); class WikiPlugin_ImageThumb extends WikiPlugin { // Five required functions in a WikiPlugin. function getName () { return _("ImageThumb"); } function getDescription () { return _("Link from an image Plugin"); } function getVersion() { return preg_replace("/[Revision: $]/", '', "\$Revision: 1.00 $"); } // Establish default values for each of this plugin's arguments. function getDefaultArguments() { return array('src' => "wiki/themes/default/images/poweredby_phpwiki_51x31.png", 'target' => "wiki/themes/default/images/poweredby_phpwiki_82x31.png"); } function run($dbi, $argstr, &$request, $basepage) { extract($this->getArgs($argstr, $request)); $html = HTML::a(array('href' => $target, 'class' => '', 'title' => $src), HTML::img(array('src'=>$src)) ); return $html; } }; ?> ------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Wanted Pages SQL Problem, William Leader |
|---|---|
| Next by Date: | Re: Wanted Pages SQL Problem, Reini Urban |
| Previous by Thread: | Simple new plugin 'ImageThumb'!, Buzz |
| Next by Thread: | Question I couldn't find answers to..., Buzz |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
Free MagazinesCisco NewsReceive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business. subscribe Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field. subscribe The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business. subscribe Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company. subscribe Total Telecom Total Telecom is "The Economist of the communications industry". subscribe |