? .DS_Store
? inline_presets.patch
Index: inline.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/inline/inline.module,v
retrieving revision 1.19.2.3
diff -u -F^f -r1.19.2.3 inline.module
--- inline.module	9 Feb 2007 18:25:24 -0000	1.19.2.3
+++ inline.module	17 Feb 2007 18:39:55 -0000
@@ -57,6 +57,44 @@ function inline_settings() {
     '#options' => array('0' => t('Print only &lt;img&gt; tag'),'1' => t('Print &lt;img&gt; tag and the link to the image')),
   );
 
+  if (module_exists('imagecache')) {
+    $options = array();
+    $options['default'] = 'No Imagecache processing';
+    $presets =  _imagecache_get_presets();
+    foreach($presets as $id => $name) {
+      $options[$name] = $name;
+    }
+    $form['imagecache'] = array(
+      '#type' => 'fieldset',
+      '#title' => t('Imagecache options'),
+      '#description' => t('When the Imagecache module is installed, it can be used to scale images for inline display.')
+    );
+
+    $form['imagecache']['inline_teaser_preset'] = array(
+      '#title' => t('Teaser preset'),
+      '#description' => t('Select the imagecache preset you want to handle inline images in teaser node views.'),
+      '#type' => 'select',
+      '#options' =>  $options,
+      '#default_value' => variable_get('inline_teaser_preset', 'default'),
+    );
+    $form['imagecache']['inline_full_preset'] = array(
+      '#title' => t('Full preset'),
+      '#description' => t('Select the imagecache preset you want to handle inline images in full node views.'),
+      '#type' => 'select',
+      '#options' =>  $options,
+      '#default_value' => variable_get('inline_full_preset', 'default'),
+    );
+  }
+
+  if (module_exists('greybox')) {
+    $form['inline_use_greybox'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Use GreyBox to display full image'),
+      '#default_value' => variable_get('inline_use_greybox', 1),
+      '#return_value' => 1
+    );
+  }
+
   return system_settings_form($form);
 }
 
@@ -200,18 +238,39 @@ function theme_inline_as_link($file) {
   return l($linktext, file_create_url($file->filepath), array('title' => t('Download: @name (@size)', array('@name' => $file->filename, '@size' => format_size($file->filesize)))));
 }
 
-function theme_inline_img($file) {
-  $title = ( $file->title ? $file->title : $file->filename );
-
-  if (variable_get('inline_link_img', '1') == '1') {
-    $html .= '<a href="'. file_create_url($file->filepath) . '" title="'.t("View").': '. $title .'">';
+function theme_inline_img($file, $teaser) {
+  $title = ($file->title ? $file->title : $file->filename );
+  $preset_var = $teaser ? 'inline_teaser_preset' : 'inline_full_preset';
+
+  if (module_exists('imagecache') && variable_get($preset_var, 'default') != 'default') {
+    $image = theme('imagecache',
+      variable_get($preset_var, 'default'),
+      $file->filepath,
+      $title,
+      $title,
+      array('class' => 'inline'));
+  }
+  else {
+    $image = theme('image',
+      file_create_url($file->filepath),
+      $title,
+      $title,
+      array('class' => 'inline', 'style' => 'width: '.$file->width.'px; height:'.$file->height.'px;'),
+      FALSE);
   }
-
-  $html .= '<img style="width: '.$file->width.'px; height:'.$file->height.'px;" src="'. file_create_url($file->filepath). '" class="inline" alt="'. $title .'" title="'. $title.'" />';
 
   if (variable_get('inline_link_img', '1') == '1') {
-    $html .= '</a>';
+    $attributes = array();
+    $attributes['title'] = t("View").': '. $title;
+    if (module_exists('greybox') && variable_get('inline_use_greybox', 1)) {
+      $attributes['class'] = variable_get('greybox_class_text', 'greybox');
+    }
+    $html = l($image, file_create_url($file->filepath), $attributes, NULL, NULL, FALSE, TRUE);
+  }
+  else {
+    $html = $image;
   }
+
   return $html;
 }
 
@@ -284,7 +343,7 @@ function _inline_substitute_tags(&$node,
       if ($file->fid != NULL) {
         //decide if we should show a link or an img tag
         if (_inline_decide_img_tag($file)) {
-          $replace = theme('inline_img', $file);
+          $replace = theme('inline_img', $file, ($field == 'teaser'));
         }
         else {
           $replace = theme('inline_as_link', $file);
@@ -346,7 +405,7 @@ function _inline_decide_img_tag($file) {
       list($width, $height) = getimagesize($file->real_path);
     }
     else {
-      list($width, $height) = getimagesize($file->filepath);
+      list($width, $height) = getimagesize(file_create_url($file->filepath));
     }
 
     if (($width && $height) && ($width <= $maxwidth && $height <= $maxheight)) {
