diff --git a/_test/tests/inc/changelog_getlastrevisionat.test.php b/_test/tests/inc/changelog_getlastrevisionat.test.php
new file mode 100644
index 0000000000000000000000000000000000000000..84b185ce85658329375dd33599d6d888368530e9
--- /dev/null
+++ b/_test/tests/inc/changelog_getlastrevisionat.test.php
@@ -0,0 +1,127 @@
+<?php
+
+/**
+ * Tests for requesting revisioninfo of a revision of a page with getRevisionInfo()
+ *
+ * This class uses the files:
+ * - data/pages/mailinglist.txt
+ * - data/meta/mailinglist.changes
+ */
+class changelog_getlastrevisionat_test extends DokuWikiTest {
+
+    private $pageid = 'mailinglist';
+    
+    function setup() {
+        parent::setup();
+        global $cache_revinfo;
+        $cache =& $cache_revinfo;
+        if(isset($cache['nonexist'])) {
+            unset($cache['nonexist']);
+        }
+        if(isset($cache['mailinglist'])) {
+            unset($cache['mailinglist']);
+        }
+    }
+    
+
+    /**
+     * no nonexist.changes meta file available
+     */
+    function test_changemetadatanotexists() {
+        $rev = 1362525899;
+        $id = 'nonexist';
+        $revsexpected = false;
+
+        $pagelog = new PageChangeLog($id, $chunk_size = 8192);
+        $revs = $pagelog->getLastRevisionAt($rev);
+        $this->assertEquals($revsexpected, $revs);
+    }
+
+    /**
+     * start at exact current revision of mailinglist page
+     *
+     */
+    function test_startatexactcurrentrev() {
+        $rev = 1385051947;
+        $revsexpected = '';
+
+        //set a known timestamp
+        touch(wikiFN($this->pageid), $rev);
+
+        $pagelog = new PageChangeLog($this->pageid, $chunk_size = 8192);
+        $revs = $pagelog->getLastRevisionAt($rev);
+        $this->assertEquals($revsexpected, $revs);
+
+    }
+    
+    /**
+     * test a future revision
+     *
+     */
+    function test_futurerev() {
+        $rev = 1385051947;
+        $revsexpected = '';
+
+        //set a known timestamp
+        touch(wikiFN($this->pageid), $rev);
+        
+        $rev +=1;
+
+        $pagelog = new PageChangeLog($this->pageid, $chunk_size = 8192);
+        $revs = $pagelog->getLastRevisionAt($rev);
+        $this->assertEquals($revsexpected, $revs);
+
+    }
+
+    /**
+     * start at exact last revision of mailinglist page
+     *
+     */
+    function test_exactlastrev() {
+        $rev = 1360110636;
+        $revsexpected = 1360110636;
+
+        $pagelog = new PageChangeLog($this->pageid, $chunk_size = 8192);
+        $revs = $pagelog->getLastRevisionAt($rev);
+        $this->assertEquals($revsexpected, $revs);
+    }
+
+
+    /**
+     * Request not existing revision
+     * 
+     */
+    function test_olderrev() {
+        $rev = 1;
+        $revexpected = false;
+
+        $pagelog = new PageChangeLog($this->pageid, $chunk_size = 8192);
+        $revfound = $pagelog->getLastRevisionAt($rev);
+        $this->assertEquals($revexpected, $revfound);
+    }
+
+    /**
+     * Start at non existing revision somewhere between existing revisions
+     */
+    function test_notexistingrev() {
+        $rev = 1362525890;
+        $revexpected = 1362525359;
+
+        $pagelog = new PageChangeLog($this->pageid, $chunk_size = 8192);
+        $revfound = $pagelog->getLastRevisionAt($rev);
+        $this->assertEquals($revexpected, $revfound);
+    }
+
+    /**
+     * request nonexisting page
+     *
+     */
+    function test_notexistingpage() {
+        $rev = 1385051947;
+        $currentexpected = false;
+
+        $pagelog = new PageChangeLog('nonexistingpage', $chunk_size = 8192);
+        $current = $pagelog->getLastRevisionAt($rev);
+        $this->assertEquals($currentexpected, $current);
+    }
+}
\ No newline at end of file
diff --git a/_test/tests/inc/common_ml.test.php b/_test/tests/inc/common_ml.test.php
index 415c0a88de4e8f178714af144bb37426ada82279..027dcaef256562ecddface2c758cff52df72a9b4 100644
--- a/_test/tests/inc/common_ml.test.php
+++ b/_test/tests/inc/common_ml.test.php
@@ -146,4 +146,15 @@ class common_ml_test extends DokuWikiTest {
         $this->assertEquals($expect, ml($id, $args));
 
     }
+    
+    function test_ml_empty_rev() {
+        global $conf;
+        $conf['useslash'] = 0;
+        $conf['userewrite'] = 0;
+
+        $args = array('a' => 'b', 'c' => 'd', 'rev' => '');
+
+        $expect = DOKU_BASE . $this->script . '?a=b&amp;c=d&amp;media=some:img.jpg';
+        $this->assertEquals($expect, ml('some:img.jpg', $args));
+    }
 }
diff --git a/_test/tests/inc/common_wl.test.php b/_test/tests/inc/common_wl.test.php
index 2e34dcae3c4aa3eec9919a625a49c7e316bf5543..4bfde3f3945c9e75ec94abbba23b74b105f41bb1 100644
--- a/_test/tests/inc/common_wl.test.php
+++ b/_test/tests/inc/common_wl.test.php
@@ -142,6 +142,17 @@ class common_wl_test extends DokuWikiTest {
         $expect = DOKU_BASE . DOKU_SCRIPT . '/some/one?a=b&c=d';
         $this->assertEquals($expect, wl('some:one', 'a=b,c=d', false, '&'));
     }
+    
+    function test_wl_empty_rev() {
+        global $conf;
+        $conf['useslash'] = 0;
+        $conf['userewrite'] = 0;
+
+        $args = array('a' => 'b', 'c' => 'd', 'rev' => '');
+
+        $expect = DOKU_BASE . DOKU_SCRIPT . '?id=some:&amp;a=b&amp;c=d';
+        $this->assertEquals($expect, wl('some:', $args));
+    }
 
 
 
diff --git a/doku.php b/doku.php
index da3643544eb2e8e712d9e64247e8f0a9475fba4d..f4309d122698f339f84321ab185f346c9334094c 100644
--- a/doku.php
+++ b/doku.php
@@ -34,6 +34,7 @@ $QUERY          = trim($INPUT->str('id'));
 $ID             = getID();
 
 $REV   = $INPUT->int('rev');
+$DATE_AT = $INPUT->str('at');
 $IDX   = $INPUT->str('idx');
 $DATE  = $INPUT->int('date');
 $RANGE = $INPUT->str('range');
@@ -47,7 +48,41 @@ $PRE = cleanText(substr($INPUT->post->str('prefix'), 0, -1));
 $SUF = cleanText($INPUT->post->str('suffix'));
 $SUM = $INPUT->post->str('summary');
 
-//make info about the selected page available
+
+//parse DATE_AT
+if($DATE_AT) {
+    $date_parse = strtotime($DATE_AT);
+    if($date_parse) {
+        $DATE_AT = $date_parse;
+    } else { // check for UNIX Timestamp
+        $date_parse = @date('Ymd',$DATE_AT);
+        if(!$date_parse || $date_parse === '19700101') {
+            msg(sprintf($lang['unable_to_parse_date'], $DATE_AT));
+            $DATE_AT = null;
+        }
+    }
+}
+
+//check for existing $REV related to $DATE_AT
+if($DATE_AT) {
+    $pagelog = new PageChangeLog($ID);
+    $rev_t = $pagelog->getLastRevisionAt($DATE_AT);
+    if($rev_t === '') { //current revision
+        $REV = null;
+        $DATE_AT = null;
+    } else if ($rev_t === false) { //page did not exist
+        $rev_n = $pagelog->getRelativeRevision($DATE_AT,+1);
+        msg(sprintf($lang['page_nonexist_rev'], 
+            strftime($conf['dformat'],$DATE_AT),
+            wl($ID, array('rev' => $rev_n)),
+            strftime($conf['dformat'],$rev_n)));
+        $REV = $DATE_AT; //will result in a page not exists message
+    } else {
+        $REV = $rev_t;
+    }
+}
+
+//make infos about the selected page available
 $INFO = pageinfo();
 
 //export minimal info to JS, plugins can add more
diff --git a/inc/changelog.php b/inc/changelog.php
index 8c14f21b06ae980d3eea0967efcfb825e84892b0..6af336fc23c32b3ff2d8e2be4922abcda3b5a4ac 100644
--- a/inc/changelog.php
+++ b/inc/changelog.php
@@ -845,6 +845,25 @@ abstract class ChangeLog {
     public function isCurrentRevision($rev) {
         return $rev == @filemtime($this->getFilename());
     }
+    
+    /**
+    * Return an existing revision for a specific date which is 
+    * the current one or younger or equal then the date
+    *
+    * @param string $id 
+    * @param number $date_at timestamp
+    * @return string revision ('' for current)
+    */
+    function getLastRevisionAt($date_at){
+        //requested date_at(timestamp) younger or equal then modified_time($this->id) => load current
+        if($date_at >= @filemtime($this->getFilename())) { 
+            return '';
+        } else if ($rev = $this->getRelativeRevision($date_at+1, -1)) { //+1 to get also the requested date revision
+            return $rev;
+        } else {
+            return false;
+        }
+    }
 
     /**
      * Returns the next lines of the changelog  of the chunck before head or after tail
@@ -1072,3 +1091,4 @@ function getRevisions($id, $first, $num, $chunk_size = 8192, $media = false) {
     }
     return $changelog->getRevisions($first, $num);
 }
+
diff --git a/inc/common.php b/inc/common.php
index e56285f6223462a67c11b7f6c98a857cfef0f7fc..11b8a7e26244e8d118e73522ec5044d96a44083d 100644
--- a/inc/common.php
+++ b/inc/common.php
@@ -438,6 +438,8 @@ function idfilter($id, $ue = true) {
 function wl($id = '', $urlParameters = '', $absolute = false, $separator = '&amp;') {
     global $conf;
     if(is_array($urlParameters)) {
+        if(isset($urlParameters['rev']) && !$urlParameters['rev']) unset($urlParameters['rev']);
+        if(isset($urlParameters['at']) && $conf['date_at_format']) $urlParameters['at'] = date($conf['date_at_format'],$urlParameters['at']);
         $urlParameters = buildURLparams($urlParameters, $separator);
     } else {
         $urlParameters = str_replace(',', $separator, $urlParameters);
@@ -544,6 +546,7 @@ function ml($id = '', $more = '', $direct = true, $sep = '&amp;', $abs = false)
         if(empty($more['w'])) unset($more['w']);
         if(empty($more['h'])) unset($more['h']);
         if(isset($more['id']) && $direct) unset($more['id']);
+        if(isset($more['rev']) && !$more['rev']) unset($more['rev']);
         $more = buildURLparams($more, $sep);
     } else {
         $matches = array();
diff --git a/inc/html.php b/inc/html.php
index a65fdfc31bbe01fd31fa0692eb7dee714f951c49..495bdf919d9e8736e2541f9772b77cf33cd8d580 100644
--- a/inc/html.php
+++ b/inc/html.php
@@ -222,6 +222,7 @@ function html_show($txt=null){
     global $REV;
     global $HIGH;
     global $INFO;
+    global $DATE_AT;
     //disable section editing for old revisions or in preview
     if($txt || $REV){
         $secedit = false;
@@ -241,8 +242,8 @@ function html_show($txt=null){
         echo '</div></div>';
 
     }else{
-        if ($REV) print p_locale_xhtml('showrev');
-        $html = p_wiki_xhtml($ID,$REV,true);
+        if ($REV||$DATE_AT) print p_locale_xhtml('showrev');
+        $html = p_wiki_xhtml($ID,$REV,true,$DATE_AT);
         $html = html_secedit($html,$secedit);
         if($INFO['prependTOC']) $html = tpl_toc(true).$html;
         $html = html_hilight($html,$HIGH);
diff --git a/inc/lang/en/lang.php b/inc/lang/en/lang.php
index 3190b0e138c7bf911c50fa432c3533e5f847db8e..fb455f85fc643779e2f8e0236df3096a092ab48a 100644
--- a/inc/lang/en/lang.php
+++ b/inc/lang/en/lang.php
@@ -368,4 +368,6 @@ $lang['currentns']             = 'Current namespace';
 $lang['searchresult']          = 'Search Result';
 $lang['plainhtml']             = 'Plain HTML';
 $lang['wikimarkup']            = 'Wiki Markup';
+$lang['page_nonexist_rev']     = 'Page did not exist at %s. It was subsequently created at <a href="%s">%s</a>.';
+$lang['unable_to_parse_date']  = 'Unable to parse at parameter "%s".';
 //Setup VIM: ex: et ts=2 :
diff --git a/inc/pageutils.php b/inc/pageutils.php
index 5f62926e42778307e095d1a1aa91923f166ce858..49c00d36fc43000c6f00c3474b11c82469aa2ca3 100644
--- a/inc/pageutils.php
+++ b/inc/pageutils.php
@@ -255,7 +255,13 @@ function sectionID($title,&$check) {
  * @param bool       $clean  flag indicating that $id should be cleaned (see wikiFN as well)
  * @return bool exists?
  */
-function page_exists($id,$rev='',$clean=true) {
+function page_exists($id,$rev='',$clean=true, $date_at=false) {
+    if($rev !== '' && $date_at) {
+        $pagelog = new PageChangeLog($id);
+        $pagelog_rev = $pagelog->getLastRevisionAt($rev);
+        if($pagelog_rev !== false)
+            $rev = $pagelog_rev;
+    }
     return @file_exists(wikiFN($id,$rev,$clean));
 }
 
@@ -486,9 +492,17 @@ function resolve_id($ns,$id,$clean=true){
  * @param string &$page   (reference) relative media id, updated to resolved id
  * @param bool   &$exists (reference) updated with existance of media
  */
-function resolve_mediaid($ns,&$page,&$exists){
+function resolve_mediaid($ns,&$page,&$exists,$rev='',$date_at=false){
     $page   = resolve_id($ns,$page);
-    $file   = mediaFN($page);
+    if($rev !== '' &&  $date_at){
+        $medialog = new MediaChangeLog($page);
+        $medialog_rev = $medialog->getLastRevisionAt($rev);
+        if($medialog_rev !== false) {
+            $rev = $medialog_rev;
+        }
+    }
+    
+    $file   = mediaFN($page,$rev);
     $exists = @file_exists($file);
 }
 
@@ -501,7 +515,7 @@ function resolve_mediaid($ns,&$page,&$exists){
  * @param string &$page   (reference) relative page id, updated to resolved id
  * @param bool   &$exists (reference) updated with existance of media
  */
-function resolve_pageid($ns,&$page,&$exists){
+function resolve_pageid($ns,&$page,&$exists,$rev='',$date_at=false ){
     global $conf;
     global $ID;
     $exists = false;
@@ -521,20 +535,26 @@ function resolve_pageid($ns,&$page,&$exists){
     $page = resolve_id($ns,$page,false); // resolve but don't clean, yet
 
     // get filename (calls clean itself)
-    $file = wikiFN($page);
+    if($rev !== '' && $date_at) {
+        $pagelog = new PageChangeLog($page);
+        $pagelog_rev = $pagelog->getLastRevisionAt($rev);
+        if($pagelog_rev !== false)//something found
+           $rev  = $pagelog_rev;
+    }
+    $file = wikiFN($page,$rev);
 
     // if ends with colon or slash we have a namespace link
     if(in_array(substr($page,-1), array(':', ';')) ||
        ($conf['useslash'] && substr($page,-1) == '/')){
-        if(page_exists($page.$conf['start'])){
+        if(page_exists($page.$conf['start'],$rev,true,$date_at)){
             // start page inside namespace
             $page = $page.$conf['start'];
             $exists = true;
-        }elseif(page_exists($page.noNS(cleanID($page)))){
+        }elseif(page_exists($page.noNS(cleanID($page)),$rev,true,$date_at)){
             // page named like the NS inside the NS
             $page = $page.noNS(cleanID($page));
             $exists = true;
-        }elseif(page_exists($page)){
+        }elseif(page_exists($page,$rev,true,$date_at)){
             // page like namespace exists
             $page = $page;
             $exists = true;
@@ -551,7 +571,7 @@ function resolve_pageid($ns,&$page,&$exists){
                 }else{
                     $try = $page.'s';
                 }
-                if(page_exists($try)){
+                if(page_exists($try,$rev,true,$date_at)){
                     $page   = $try;
                     $exists = true;
                 }
diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php
index 44ead9d45c0c71a734f121bcad5f7418fd5479fe..5627a035364afe8625aa37ea3debaf3195bd358a 100644
--- a/inc/parser/xhtml.php
+++ b/inc/parser/xhtml.php
@@ -28,6 +28,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
 
     /** @var array A stack of section edit data */
     protected $sectionedits = array();
+    var $date_at = '';    // link pages and media against this revision
 
     /** @var int last section edit id, used by startSectionEdit */
     protected $lastsecid = 0;
@@ -818,7 +819,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
         $default = $this->_simpleTitle($id);
 
         // now first resolve and clean up the $id
-        resolve_pageid(getNS($ID), $id, $exists);
+        resolve_pageid(getNS($ID), $id, $exists, $this->date_at, true);
 
         $name = $this->_getLinkTitle($name, $default, $isImage, $id, $linktype);
         if(!$isImage) {
@@ -846,11 +847,14 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
             $link['pre'] = '<span class="curid">';
             $link['suf'] = '</span>';
         }
-        $link['more']  = '';
-        $link['class'] = $class;
-        $link['url']   = wl($id, $params);
-        $link['name']  = $name;
-        $link['title'] = $id;
+        $link['more']   = '';
+        $link['class']  = $class;
+        if($this->date_at) {
+            $params['at'] = $this->date_at;
+        }
+        $link['url']    = wl($id, $params);
+        $link['name']   = $name;
+        $link['title']  = $id;
         //add search string
         if($search) {
             ($conf['userewrite']) ? $link['url'] .= '?' : $link['url'] .= '&amp;';
@@ -1062,7 +1066,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
                            $height = null, $cache = null, $linking = null, $return = false) {
         global $ID;
         list($src, $hash) = explode('#', $src, 2);
-        resolve_mediaid(getNS($ID), $src, $exists);
+        resolve_mediaid(getNS($ID), $src, $exists, $this->date_at, true);
 
         $noLink = false;
         $render = ($linking == 'linkonly') ? false : true;
@@ -1070,7 +1074,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
 
         list($ext, $mime) = mimetype($src, false);
         if(substr($mime, 0, 5) == 'image' && $render) {
-            $link['url'] = ml($src, array('id' => $ID, 'cache' => $cache), ($linking == 'direct'));
+            $link['url'] = ml($src, array('id' => $ID, 'cache' => $cache, 'rev'=>$this->_getLastMediaRevisionAt($src)), ($linking == 'direct'));
         } elseif(($mime == 'application/x-shockwave-flash' || media_supportedav($mime)) && $render) {
             // don't link movies
             $noLink = true;
@@ -1078,7 +1082,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
             // add file icons
             $class = preg_replace('/[^_\-a-z0-9]+/i', '_', $ext);
             $link['class'] .= ' mediafile mf_'.$class;
-            $link['url'] = ml($src, array('id' => $ID, 'cache' => $cache), true);
+            $link['url'] = ml($src, array('id' => $ID, 'cache' => $cache , 'rev'=>$this->_getLastMediaRevisionAt($src)), true);
             if($exists) $link['title'] .= ' ('.filesize_h(filesize(mediaFN($src))).')';
         }
 
@@ -1436,7 +1440,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
                 return $title;
             }
             //add image tag
-            $ret .= '<img src="'.ml($src, array('w' => $width, 'h' => $height, 'cache' => $cache)).'"';
+            $ret .= '<img src="'.ml($src, array('w' => $width, 'h' => $height, 'cache' => $cache, 'rev'=>$this->_getLastMediaRevisionAt($src))).'"';
             $ret .= ' class="media'.$align.'"';
 
             if($title) {
@@ -1581,7 +1585,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
         // see internalmedia() and externalmedia()
         list($img['src']) = explode('#', $img['src'], 2);
         if($img['type'] == 'internalmedia') {
-            resolve_mediaid(getNS($ID), $img['src'], $exists);
+            resolve_mediaid(getNS($ID), $img['src'], $exists ,$this->date_at, true);
         }
 
         return $this->_media(
@@ -1740,6 +1744,21 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
         $out .= '</audio>'.NL;
         return $out;
     }
+    
+    /**
+     * _getLastMediaRevisionAt is a helperfunction to internalmedia() and _media()
+     * which returns an existing media revision less or equal to rev or date_at
+     *
+     * @author lisps
+     * @param string $media_id
+     * @access protected
+     * @return string revision ('' for current)
+     */
+    function _getLastMediaRevisionAt($media_id){
+        if(!$this->date_at || media_isexternal($media_id)) return '';
+        $pagelog = new MediaChangeLog($media_id);
+        return $pagelog->getLastRevisionAt($this->date_at);
+    }
 
     #endregion
 }
diff --git a/inc/parserutils.php b/inc/parserutils.php
index 9c2a0b570fe4886c47dea60c6bc55c8f472b3eec..4aebec2c8e86e4906b52fd7b947b82d149b5424c 100644
--- a/inc/parserutils.php
+++ b/inc/parserutils.php
@@ -56,7 +56,7 @@ define('METADATA_RENDER_UNLIMITED', 4);
  *
  * @author Andreas Gohr <andi@splitbrain.org>
  */
-function p_wiki_xhtml($id, $rev='', $excuse=true){
+function p_wiki_xhtml($id, $rev='', $excuse=true,$date_at=''){
     $file = wikiFN($id,$rev);
     $ret  = '';
 
@@ -65,9 +65,9 @@ function p_wiki_xhtml($id, $rev='', $excuse=true){
     $keep = $ID;
     $ID   = $id;
 
-    if($rev){
+    if($rev || $date_at){
         if(@file_exists($file)){
-            $ret = p_render('xhtml',p_get_instructions(io_readWikiPage($file,$id,$rev)),$info); //no caching on old revisions
+            $ret = p_render('xhtml',p_get_instructions(io_readWikiPage($file,$id,$rev)),$info,$date_at); //no caching on old revisions
         }elseif($excuse){
             $ret = p_locale_xhtml('norev');
         }
@@ -583,7 +583,7 @@ function p_sort_modes($a, $b){
  * @author Harry Fuecks <hfuecks@gmail.com>
  * @author Andreas Gohr <andi@splitbrain.org>
  */
-function p_render($mode,$instructions,&$info){
+function p_render($mode,$instructions,&$info,$date_at=''){
     if(is_null($instructions)) return '';
 
     $Renderer = p_get_renderer($mode);
@@ -591,6 +591,10 @@ function p_render($mode,$instructions,&$info){
 
     $Renderer->reset();
 
+    if($date_at) {
+        $Renderer->date_at = $date_at;
+    }
+    
     $Renderer->smileys = getSmileys();
     $Renderer->entities = getEntities();
     $Renderer->acronyms = getAcronyms();
diff --git a/inc/template.php b/inc/template.php
index 7f3c68534dcd8dfc8cb25fb9bb2c55e857d94a03..2dd77502f2f1dd06bd6aeb0918b139671fdbbf59 100644
--- a/inc/template.php
+++ b/inc/template.php
@@ -1123,6 +1123,7 @@ function tpl_img($maxwidth = 0, $maxheight = 0, $link = true, $params = null) {
     global $IMG;
     /** @var Input $INPUT */
     global $INPUT;
+    global $REV;
     $w = tpl_img_getTag('File.Width');
     $h = tpl_img_getTag('File.Height');
 
@@ -1147,8 +1148,8 @@ function tpl_img($maxwidth = 0, $maxheight = 0, $link = true, $params = null) {
     }
 
     //prepare URLs
-    $url = ml($IMG, array('cache'=> $INPUT->str('cache')), true, '&');
-    $src = ml($IMG, array('cache'=> $INPUT->str('cache'), 'w'=> $w, 'h'=> $h), true, '&');
+    $url = ml($IMG, array('cache'=> $INPUT->str('cache'),'rev'=>$REV), true, '&');
+    $src = ml($IMG, array('cache'=> $INPUT->str('cache'),'rev'=>$REV, 'w'=> $w, 'h'=> $h), true, '&');
 
     //prepare attributes
     $alt = tpl_img_getTag('Simple.Title');
diff --git a/lib/exe/detail.php b/lib/exe/detail.php
index cd3f362ad69b460016ce9e1e055e3db2da0a503e..cc29d5b87914c4fb6f33e45d0fddb909bbc565be 100644
--- a/lib/exe/detail.php
+++ b/lib/exe/detail.php
@@ -5,6 +5,7 @@ require_once(DOKU_INC.'inc/init.php');
 
 $IMG  = getID('media');
 $ID   = cleanID($INPUT->str('id'));
+$REV  = $INPUT->int('rev');
 
 // this makes some general info available as well as the info about the
 // "parent" page
@@ -35,7 +36,7 @@ $ERROR = false;
 $AUTH = auth_quickaclcheck($IMG);
 if($AUTH >= AUTH_READ){
     // check if image exists
-    $SRC = mediaFN($IMG);
+    $SRC = mediaFN($IMG,$REV); 
     if(!@file_exists($SRC)){
         //doesn't exist!
         http_status(404);
diff --git a/lib/tpl/dokuwiki/detail.php b/lib/tpl/dokuwiki/detail.php
index 8fe2c88a22432508117f96e51b0a2b6703ebe124..9bd841d8c182182b4689f72a9eaae2fe8bedcab2 100644
--- a/lib/tpl/dokuwiki/detail.php
+++ b/lib/tpl/dokuwiki/detail.php
@@ -49,7 +49,7 @@ header('X-UA-Compatible: IE=edge,chrome=1');
                     if($ERROR):
                         echo '<h1>'.$ERROR.'</h1>';
                     else: ?>
-
+                        <?php if($REV) echo p_locale_xhtml('showrev');?>
                         <h1><?php echo nl2br(hsc(tpl_img_getTag('simple.title'))); ?></h1>
 
                         <?php tpl_img(900,700); /* parameters: maximum width, maximum height (and more) */ ?>