00106: Add cookbook entry describing relative image URLs

Summary: Add cookbook entry describing relative image URLs
Created: 2004-10-19 15:14
Status: Closed - added as Cookbook:RelativeLinks
Category: Cookbook
From: Pm
Assigned:
Priority: 55553
Version: all
OS:

Description

There needs to be a cookbook entry that describes how a wiki administrator can enable relative image urls.

I'd like to see [[/dir/file.name]] work in the same way as a webmaster would expect <a href="/dir/file.name"> or <img src="/dir/file.name">
For images that were http://foo.bar.com/img/x.gif I suggest [[|/img/x.gif]]
-Simon

Comments by Christian

  • Such a markup should not be restricted only to referring to local files, it should work just as well referring to a local file.
  • I'm worried that simply using [[/Dir/SomeFile]] might interfere with a page reference - primarily if we are referring to a file without an extension.
    • If we ever go for page hierarchies, the syntax given above would probably interfere with this.
  • Plain [[/Dir/SomeFile]] is a bit too similar to page links IMO.
  • Here are some suggestions for alternate ways:
 
	[[local:/dir/some/file]]	-> /dir/some/file
	[[dir:/dir/some/file]]		-> /dir/some/file
	[[file:/dir/some/file]]		-> /dir/some/file
	[[//dir/some/file]]		-> /dir/some/file
	[[cwd:/dir/some/file]]		-> /dir/some/file
	[[cwd:some/file]]		-> ./some/file

In a wild revelation of ignorance - John Morris offers:

Doesn't Intermap already serve this function in an acceptable manner?

maplink:imagename.ext seems pretty simple.

Would it not also suffice for the other requirements?


Array
(
    [post_max_size] => 64M
    [$_POST keys] => 
    [$_REQUEST keys] => n
    [$_SERVER] => Array
        (
            [CONTEXT_DOCUMENT_ROOT] => /home/pmwiki/public_html
            [CONTEXT_PREFIX] => 
            [DOCUMENT_ROOT] => /home/pmwiki/public_html
            [GATEWAY_INTERFACE] => CGI/1.1
            [HTTPS] => on
            [HTTP_ACCEPT] => */*
            [HTTP_ACCEPT_ENCODING] => gzip, br, zstd, deflate
            [HTTP_HOST] => www.pmwiki.org
            [HTTP_REFERER] => http://www.pmwiki.org/wiki/PITS/00106
            [HTTP_USER_AGENT] => Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
            [HTTP_X_HTTPS] => 1
            [PATH] => /bin:/usr/bin
            [PHP_INI_SCAN_DIR] => /opt/cpanel/ea-php70/root/etc:/opt/cpanel/ea-php70/root/etc/php.d:.
            [QUERY_STRING] => n=PITS%2f00106
            [REDIRECT_HTTPS] => on
            [REDIRECT_QUERY_STRING] => n=PITS%2f00106
            [REDIRECT_SCRIPT_URI] => https://www.pmwiki.org/wiki/PITS/00106
            [REDIRECT_SCRIPT_URL] => /wiki/PITS/00106
            [REDIRECT_SSL_TLS_SNI] => www.pmwiki.org
            [REDIRECT_STATUS] => 200
            [REDIRECT_UNIQUE_ID] => afMoY9M455BNEySt0g1nRwAAAAY
            [REDIRECT_URL] => /wiki/PITS/00106
            [REMOTE_ADDR] => 216.73.216.25
            [REMOTE_PORT] => 53925
            [REQUEST_METHOD] => GET
            [REQUEST_SCHEME] => https
            [REQUEST_URI] => /wiki/PITS/00106
            [SCRIPT_FILENAME] => /home/pmwiki/public_html/index.php
            [SCRIPT_NAME] => /index.php
            [SCRIPT_URI] => https://www.pmwiki.org/wiki/PITS/00106
            [SCRIPT_URL] => /wiki/PITS/00106
            [SERVER_ADDR] => 23.254.203.248
            [SERVER_ADMIN] => webmaster@pmwiki.org
            [SERVER_NAME] => www.pmwiki.org
            [SERVER_PORT] => 443
            [SERVER_PROTOCOL] => HTTP/1.1
            [SERVER_SIGNATURE] => 
            [SERVER_SOFTWARE] => Apache
            [SSL_TLS_SNI] => www.pmwiki.org
            [TZ] => America/Los_Angeles
            [UNIQUE_ID] => afMoY9M455BNEySt0g1nRwAAAAY
            [PHP_SELF] => /index.php
            [REQUEST_TIME_FLOAT] => 1777543267.8752
            [REQUEST_TIME] => 1777543267
            [argv] => Array
                (
                    [0] => n=PITS%2f00106
                )

            [argc] => 1
        )

)