diff --git includes/common.inc includes/common.inc
index a18e4d6..feaec86 100644
--- includes/common.inc
+++ includes/common.inc
@@ -6562,19 +6562,20 @@ function entity_prepare_view($entity_type, $entities) {
 }
 
 /**
- * Returns the path to an entity.
+ * Returns the path and path options to an entity.
  *
  * @param $entity_type
  *   The entity type; e.g. 'node' or 'user'.
  * @param $entity
  *   The entity for which to generate a path.
  * @return
- *   The path for the entity, or NULL if the entity has no page of its own.
+ *   An array containing the path and options for the entity, or NULL if the
+ *   entity has no page of its own.
  */
 function entity_path($entity_type, $entity) {
   $info = entity_get_info($entity_type);
   if (isset($info['path callback']) && function_exists($info['path callback'])) {
-    return $info['path callback']($entity);
+    return $info['path callback']($entity) + array('options' => array());
   }
 }
 /**
diff --git modules/comment/comment.module modules/comment/comment.module
index a3143f8..36d667c 100644
--- modules/comment/comment.module
+++ modules/comment/comment.module
@@ -151,7 +151,10 @@ function comment_node_type_load($name) {
  * Entity path callback.
  */
 function comment_path($comment) {
-  return 'comment/' . $comment->cid;
+  return array(
+    'path' => 'comment/' . $comment->cid,
+    'options' => array('fragment' => 'comment-' . $comment->cid),
+  );
 }
 
 /**
diff --git modules/image/image.field.inc modules/image/image.field.inc
index 6bbc691..673fe9b 100644
--- modules/image/image.field.inc
+++ modules/image/image.field.inc
@@ -469,7 +469,10 @@ function image_field_formatter_view($obj_type, $object, $field, $instance, $lang
 
   foreach ($items as $delta => $item) {
     if (isset($link_file)) {
-      $path = file_create_url($item['uri']);
+      $path = array(
+        'path' => file_create_url($item['uri']),
+        'options' => array(),
+      );
     }
     $element[$delta] = array(
       '#theme' => 'image_formatter',
@@ -479,7 +482,7 @@ function image_field_formatter_view($obj_type, $object, $field, $instance, $lang
     );
   }
 
-   return $element;
+  return $element;
 }
 
 /**
@@ -502,7 +505,11 @@ function theme_image_formatter($variables) {
   }
 
   if ($variables['path']) {
-    $output = l($output, $variables['path'], array('html' => TRUE));
+    $path = $variables['path']['path'];
+    $options = $variables['path']['options'];
+    // When displaying an image inside a link, the html option must be TRUE.
+    $options['html'] = TRUE;
+    $output = l($output, $path, $options);
   }
 
   return $output;
diff --git modules/node/node.module modules/node/node.module
index ce6026d..ef4b71b 100644
--- modules/node/node.module
+++ modules/node/node.module
@@ -246,7 +246,9 @@ function node_entity_info() {
  * Entity path callback.
  */
 function node_path($node) {
-  return 'node/' . $node->nid;
+  return array(
+    'path' => 'node/' . $node->nid,
+  );
 }
 
 /**
diff --git modules/system/system.api.php modules/system/system.api.php
index f15a897..f94bd9b 100644
--- modules/system/system.api.php
+++ modules/system/system.api.php
@@ -66,8 +66,8 @@ function hook_hook_info() {
  *     static caching of entities during a page request. Defaults to TRUE.
  *   - load hook: The name of the hook which should be invoked by
  *     DrupalDefaultEntityController:attachLoad(), for example 'node_load'.
- *   - path callback: A function taking an entity as argument and returning the
- *     path to the entity.
+ *   - path callback: A function taking an entity as argument and returning an
+ *     array whose keys match the url() input parameters.
  *   - fieldable: Set to TRUE if you want your entity type to be fieldable.
  *   - object keys: An array describing how the Field API can extract the
  *     information it needs from the objects of the type. Elements:
diff --git modules/taxonomy/taxonomy.module modules/taxonomy/taxonomy.module
index a5b8929..32eb063 100644
--- modules/taxonomy/taxonomy.module
+++ modules/taxonomy/taxonomy.module
@@ -133,7 +133,9 @@ function taxonomy_entity_info() {
  * Entity path callback.
  */
 function taxonomy_term_path($term) {
-  return 'taxonomy/term/' . $term->tid;
+  return array(
+    'path' => 'taxonomy/term/' . $term->tid,
+  );
 }
 
 /**
diff --git modules/user/user.module modules/user/user.module
index 837ae2a..29d44b3 100644
--- modules/user/user.module
+++ modules/user/user.module
@@ -153,7 +153,9 @@ function user_entity_info() {
  * Entity path callback.
  */
 function user_path($user) {
-  return 'user/' . $user->uid;
+  return array(
+    'path' => 'user/' . $user->uid,
+  );
 }
 
 /**
