--- urlicon/urlicon.module	2008-10-06 23:11:02.000000000 +0200
+++ urlicon-patched/urlicon.module	2009-02-17 22:10:40.000000000 +0100
@@ -87,6 +87,9 @@
  * Callback for filter
  */
 function _urlicon_format_class($match) {
+  # skip if this link is around an image
+  if (stripos($match[3], '<img ') !== false) return $match[0];
+
   $url = parse_url($match[1]);
   $domain = explode('.', $url['host']);
   $domain = $domain[(count($domain)-2)];
@@ -101,6 +104,9 @@
  * Callback for filter
  */
 function _urlicon_format_icon($match) {
+  # skip if this link is around an image
+  if (stripos($match[3], '<img ') !== false) return $match[0];
+
   $dir = UI_FILE_PATH;
   
   $url = @parse_url($match[1]);
@@ -118,6 +124,9 @@
  * Callback for filter
  */
 function _urlicon_format_favicon($match) {
+  # skip if this link is around an image
+  if (stripos($match[3], '<img ') !== false) return $match[0];
+
   // Define acceptable Content-Types
   // see http://www.iana.org/assignments/media-types/image/vnd.microsoft.icon
   // Additional Content-Types suggested by W3C
@@ -277,4 +286,4 @@
 function theme_urlicon($text, $favicon, $path, $attributes = array()) {
   $favicon = '<img src="'. $favicon .'" '. drupal_attributes($attributes) .' />';
   return l($text .' '. $favicon, $path, array('absolute' => TRUE, 'html' => TRUE));
-}
\ No newline at end of file
+}
