Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.2.3

Request #7929 Image should support same link style as wikilink
Submitted: 2006-06-16 17:54 UTC
From: bjs5075 at rit dot edu Assigned:
Status: Open Package: Text_Wiki (version 1.1.0)
PHP Version: 5.1.2 OS: Debian etch
Roadmaps: (Not assigned)    
Subscription  


 [2006-06-16 17:54 UTC] bjs5075 at rit dot edu (Brian Sipos)
Description: ------------ It would be simple and backwards-compatable to have image 'src' links be generated in the same style as wikilink 'href' links. This allows images to be generated dynamically with request parameters just as pages are now. Here is a diff that will make the requested change: --- Image.php-old 2006-02-10 18:07:03.000000000 -0500 +++ Image.php 2006-06-16 13:42:19.000000000 -0400 @@ -53,9 +53,19 @@ // is the source a local file or URL? if (strpos($src, '://') === false) { - // the source refers to a local file. - // add the URL base to it. - $src = $this->getConf('base', '/') . $src; + // link to the image view, but we have to build + // the SRC. we support both the old form where + // the image always comes at the end, and the new + // form that uses %s for sprintf() + $pattern = $this->getConf('base'); + + if (strpos($pattern, '%s') === false) { + // use the old form (image-at-end) + $src = $pattern . $src; + } else { + // use the new form (sprintf format string) + $src = sprintf($pattern, $src); + } } // stephane@metacites.net

Comments