--- g2embed.php.old	2005-10-19 20:13:52.049061509 +0200
+++ g2embed.php	2005-10-19 20:09:25.823470545 +0200
@@ -470,6 +470,18 @@
 }
 
 //-------------------------------------------------------------------------------------------------------
+// Parse Plugin quicktag for image path
+//-------------------------------------------------------------------------------------------------------
+
+function g2_linkbypathinpost ($text, $case_sensitive=false) {
+   $preg_flags = ($case_sensitive) ? 'e' : 'ei';
+	
+	$output = preg_replace("'\"WPG2LINK:(.*?)\"'$preg_flags", "g2_linkbypath('\\1')", $text);			
+
+	return $output;
+}
+
+//-------------------------------------------------------------------------------------------------------
 // Include image from gallery based on path
 //-------------------------------------------------------------------------------------------------------
 
@@ -582,6 +594,42 @@
 	return $img;
 }
 
+
+//-------------------------------------------------------------------------------------------------------
+// Link from gallery based on path
+//-------------------------------------------------------------------------------------------------------
+
+function g2_linkbypath( $g2inputpath ) {
+	global $g2_option;
+
+// Initialize Gallery
+	if (!defined('G2INIT')) {
+		$ret = g2_login();
+		if ($ret->isError()) {
+			echo "<h2>Fatal G2 error</h2> Here's the error from G2: " .$ret->getAsHtml(); 
+			exit;
+		}
+	}
+
+// Make Sure Item Path does not contain a + as it should instead be a space
+	$g2itempath = str_replace ("+", " ", $g2inputpath);
+
+// Get the Image
+	list ($ret, $g2itemid) = GalleryCoreAPI::fetchItemIdByPath($g2itempath);		
+	if ($ret->isError()) 
+		$link = "*** ".$g2inputpath." NOT FOUND ***";
+	else {
+		global $gallery;
+		$urlGenerator =& $gallery->getUrlGenerator();
+		$link = $urlGenerator->generateUrl(
+			array('view' => 'core.ShowItem', 'itemId' => $g2itemid),
+			false);
+	}
+
+	return "\"$link\"";
+}
+
+
 //-------------------------------------------------------------------------------------------------------
 // Imageblock Function for Side blocks
 //-------------------------------------------------------------------------------------------------------
@@ -677,4 +725,13 @@
 // Filter for WPG2 Tags - Comments - G2WP ID in post
 add_filter('comment_text', 'g2_imagebyidinpost', 0);
 
-?>
\ No newline at end of file
+// Filter for WPG2 Tags - Blog - G2WP Link in post
+add_filter('the_content', 'g2_linkbypathinpost', 0);
+
+// Filter for WPG2 Tags - Category - G2WP Link in post
+add_filter('the_excerpt', 'g2_linkbypathinpost', 0);
+
+// Filter for WPG2 Tags - Blog Excerpt -G2WP Link in post
+add_filter('excerpt_save_pre', 'g2_linkbypathinpost', 0);
+
+?>
