--- imagecache.module.bak       2011-05-11 00:40:35.000000000 +0200
+++ imagecache.module   2011-05-11 17:23:07.000000000 +0200
@@ -54,7 +54,7 @@
  * Implementation of hook_perm().
  */
 function imagecache_perm() {
-  $perms =  array('administer imagecache', 'flush imagecache');
+  $perms =  array('administer imagecache', 'flush imagecache', 'show original image on image link');
   foreach (imagecache_presets() as $preset) {
     $perms[] =  'view imagecache '. $preset['presetname'];
   }
@@ -699,22 +699,29 @@

 function theme_imagecache_formatter_imagelink($element) {
   // Inside a view $element may contain NULL data. In that case, just return.
-  if (empty($element['#item']['fid'])) {
-    return '';
-  }

-  // Extract the preset name from the formatter name.
-  $presetname = substr($element['#formatter'], 0, strrpos($element['#formatter'], '_'));
-  $style = 'imagelink';
-
-  $item = $element['#item'];
-  $item['data']['alt'] = isset($item['data']['alt']) ? $item['data']['alt'] : '';
-  $item['data']['title'] = isset($item['data']['title']) ? $item['data']['title'] : NULL;
+  if (user_access('eredeti kep megtekintese')) {
+      if (empty($element['#item']['fid'])) {
+        return '';
+      }

-  $imagetag = theme('imagecache', $presetname, $item['filepath'], $item['data']['alt'], $item['data']['title']);
-  $path = file_create_url($item['filepath']);
-  $class = "imagecache imagecache-$presetname imagecache-$style imagecache-{$element['#formatter']}";
-  return l($imagetag, $path, array('attributes' => array('class' => $class), 'html' => TRUE));
+      // Extract the preset name from the formatter name.
+      $presetname = substr($element['#formatter'], 0, strrpos($element['#formatter'], '_'));
+      $style = 'imagelink';
+
+      $item = $element['#item'];
+      $item['data']['alt'] = isset($item['data']['alt']) ? $item['data']['alt'] : '';
+      $item['data']['title'] = isset($item['data']['title']) ? $item['data']['title'] : NULL;
+
+      $imagetag = theme('imagecache', $presetname, $item['filepath'], $item['data']['alt'], $item['data']['title']);
+      $path = file_create_url($item['filepath']);
+      $class = "imagecache imagecache-$presetname imagecache-$style imagecache-{$element['#formatter']}";
+      return l($imagetag, $path, array('attributes' => array('class' => $class), 'html' => TRUE));
+  }
+else
+  {
+    return theme_imagecache_formatter_default($element);
+  }
 }
