Index: /MediaWiki/trunk/extensions/FCKeditor/FCKeditorSkin.body.php
===================================================================
--- /MediaWiki/trunk/extensions/FCKeditor/FCKeditorSkin.body.php	(revision 948)
+++ /MediaWiki/trunk/extensions/FCKeditor/FCKeditorSkin.body.php	(revision 949)
@@ -274,4 +274,53 @@
     }
 
+    /**
+	 * Create a direct link to a given uploaded file.
+	 *
+	 * @param $title Title object.
+	 * @param $text  String: pre-sanitized HTML
+	 * @return string HTML
+	 *
+	 * @public
+	 * @todo Handle invalid or missing images better.
+	 */
+    function makeMediaLinkObj( $title, $text = '' ) {
+        if( is_null( $title ) ) {
+            ### HOTFIX. Instead of breaking, return empty string.
+            return $text;
+        } else {
+            $orginal = $title->getText();
+            // Mediawiki 1.11
+            if ( function_exists('wfFindFile') ) {
+                $img  = wfFindFile( $title );
+                if( $img ) {
+                    $url  = $img->getURL();
+                    $class = 'internal';
+                } else {
+                    $upload = SpecialPage::getTitleFor( 'Upload' );
+                    $url = $upload->getLocalUrl( 'wpDestFile=' . urlencode( $title->getDbKey() ) );
+                    $class = 'new';
+                }
+            }
+            // Mediawiki 1.10
+            else {
+                $img  = new Image( $title );
+                if( $img->exists() ) {
+                    $url  = $img->getURL();
+                    $class = 'internal';
+                } else {
+                    $upload = SpecialPage::getTitleFor( 'Upload' );
+                    $url = $upload->getLocalUrl( 'wpDestFile=' . urlencode( $img->getName() ) );
+                    $class = 'new';
+                }
+            }
+            $alt = htmlspecialchars( $title->getText() );
+            if( $text == '' ) {
+                $text = $alt;
+            }
+            $u = htmlspecialchars( $url );
+            return "<a href=\"{$orginal}\" class=\"$class\" _fck_mw_type=\"media\" title=\"{$alt}\">{$text}</a>";
+        }
+    }
+
     function makeExternalLink( $url, $text, $escape = true, $linktype = '', $ns = null ) {
         $url = htmlspecialchars( $url );
Index: /MediaWiki/trunk/extensions/FCKeditor/plugins/mediawiki/fckplugin.js
===================================================================
--- /MediaWiki/trunk/extensions/FCKeditor/plugins/mediawiki/fckplugin.js	(revision 948)
+++ /MediaWiki/trunk/extensions/FCKeditor/plugins/mediawiki/fckplugin.js	(revision 949)
@@ -232,10 +232,19 @@
 							// Get the actual Link href.
 							var href = htmlNode.getAttribute( '_fcksavedurl' ) ;
+							var hrefType		= htmlNode.getAttribute( '_fck_mw_type' ) || '' ;
+							
 							if ( href == null )
 								href = htmlNode.getAttribute( 'href' , 2 ) || '' ;
 
-							var isWikiUrl = !( href.StartsWith( 'mailto:' ) || /^\w+:\/\//.test( href ) ) ;
-
-							stringBuilder.push( isWikiUrl ? '[[' : '[' ) ;
+							if ( hrefType == "media" )
+							{
+								var isWikiUrl = true ;
+								stringBuilder.push( '[[Media:' ) ;
+							}
+							else
+							{
+								var isWikiUrl = !( href.StartsWith( 'mailto:' ) || /^\w+:\/\//.test( href ) ) ;
+								stringBuilder.push( isWikiUrl ? '[[' : '[' ) ;
+							}
 							stringBuilder.push( href ) ;
 							if ( href != htmlNode.innerHTML && htmlNode.innerHTML != '[n]' )
