Please take our Survey
logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

Simple new plugin 'ImageThumb'!: msg#00026

web.wiki.phpwiki.talk

Subject: Simple new plugin 'ImageThumb'!

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>
Google Custom Search

Recently Viewed:
version-control...    qnx.openqnx.dev...    redhat.rhn.user...    ietf.openpgp/20...    mail.mutt.user/...    web.microformat...    java.sync4j.use...    education.ezpro...    user-groups.blu...    solaris.manager...    org.fitug.debat...    technology.erps...    politics.activi...    linux.redhat.fe...    bug-tracking.ma...    xfce.user/2004-...    hams/2004-11/ms...    kde.users.pim/2...    culture.cooking...    freebsd.devel.x...    gnu.m4.adhoc/20...    ngpt.user/2002-...    apple.fink.deve...   
Home | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive 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

Navigation