PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Text » Text_Wiki » Bug #7929

Image should support same link style as wikilink

Details

Request #7929Image should support same link style as wikilink
Submitted2006-06-16 17:54 UTC
Frombjs5075 at rit dot edu
StatusOpen
PackageText_Wiki
PHP Version5.1.2
OSDebian etch
Roadmaps(Not assigned)

Comments

[2006-06-16 17:54 UTC] bjs5075 at rit dot edu

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