--- image_captcha.admin.inc	2009-09-18 01:16:32.000000000 +0200
+++ new_image_captcha.admin.inc	2009-09-19 10:55:20.859375000 +0200
@@ -1,5 +1,5 @@
 <?php
-// $Id: image_captcha.admin.inc,v 1.25 2009/09/17 23:16:32 soxofaan Exp $
+// $Id: image_captcha.admin.inc,v 1.21-x 2009/09/19 22:16:48 Machi27 Exp $
 
 /**
  * @file
@@ -10,22 +10,16 @@
  * function to get a list of available fonts
  */
 function _image_captcha_available_fonts() {
-  // List of folders to search through for TrueType fonts.
+  $available_fonts = array('BUILTIN' => t('Built-in font'));
   $fontsdirectories = array(
     drupal_get_path('module', 'image_captcha') .'/fonts',
     file_directory_path(),
   );
-  // Search through the folders and build a list of available fonts.
-  $available_fonts = array();
   foreach ($fontsdirectories as $fontsdirectory) {
     foreach (file_scan_directory($fontsdirectory, '\.[tT][tT][fF]$') as $filename => $font) {
       $available_fonts[$filename] = "{$font->basename} ($filename)";
     }
   }
-
-  // Append the PHP built-in font at the end.
-  $available_fonts['BUILTIN'] = t('Built-in font');
-
   return $available_fonts;
 }
 
@@ -41,9 +35,9 @@ function image_captcha_settings_form() {
 
   // First some error checking.
   $image_captcha_setup_errno = _image_captcha_check_setup();
-  if ($image_captcha_setup_errno & IMAGE_CAPTCHA_ERROR_NO_GDLIB_WITH_JPEG) {
+  if ($image_captcha_setup_errno & IMAGE_CAPTCHA_ERROR_NO_GDLIB) {
     drupal_set_message(t(
-      'The Image CAPTCHA module can not generate images because your PHP setup does not support it (no <a href="!gdlib">GD library</a> with JPEG support).',
+      'The Image CAPTCHA module can not generate images because your PHP setup does not support it (no <a href="!gdlib">GD library</a>).',
       array('!gdlib' => 'http://php.net/manual/en/book.image.php')
     ), 'error');
     // It is no use to continue building the rest of the settings form.
@@ -60,6 +54,23 @@ function image_captcha_settings_form() {
     '#captcha_type' => 'image_captcha/Image',
     '#captcha_admin_mode' => TRUE,
   );
+  
+  // image tyoe settings JPG, PNG OR PNG transparent background
+    $form['image_captcha_type_settings'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Image settings'),
+  );
+  $form['image_captcha_type_settings']['image_captcha_image_format'] = array(
+    '#type' => 'select',
+    '#title' => t('Type'),
+    '#description' => 'Select image type, JPG or PNG.',
+    '#default_value' => variable_get('image_captcha_type_img', 'jpg'),
+    '#options' => array(
+      1 => 'jpg',
+	  2 => 'png',
+	  3 => 'png - ' . t('transparent background'),
+    ),
+  );
 
   // General code settings.
   $form['image_captcha_code_settings'] = array(
@@ -90,13 +101,9 @@ function image_captcha_settings_form() {
     '#type' => 'select',
     '#title' => t('Font'),
     '#default_value' => $default_font,
-    '#description' => t('Select the font to use for the text in the image CAPTCHA. Apart from the provided defaults, you can also use your own TrueType font: put a TrueType font file (filename extension .ttf) in the "fonts" directory of the image CAPTCHA module (directory "%fontsdir") or in the Drupal "files" directory (directory "%filesdir").',
-      array('%fontsdir' => drupal_get_path('module', 'image_captcha') .'/fonts',
-        '%filesdir' => file_directory_path())
-    ),
+    '#description' => t('The TrueType font (.ttf) to use for the text in the image CAPTCHA.'),
     '#options' => $available_fonts,
   );
-
   // add a prerender procedure for checking that a font should be set.
   $form['#pre_render'] = array('image_captcha_settings_form_pre_render');
   // font size
@@ -186,19 +193,19 @@ function image_captcha_settings_form() {
     '#type' => 'select',
     '#title' => t('Distortion level'),
     '#options' => array(
-      0 => t('@level - no distortion', array('@level' => '0')),
-      1 => t('@level - low', array('@level' => '1')),
-      2 => '2',
+      0 => '0 - '. t('none'),
+      1 => '1',
+      2 => '2 - '. t('low'),
       3 => '3',
-      4 => '4',
-      5 => t('@level - medium', array('@level' => '5')),
-      6 => '6',
+      4 => '4 - '. t('moderate'),
+      5 => '5',
+      6 => '6 - '. t('normal'),
       7 => '7',
-      8 => '8',
+      8 => '8 - '. t('high'),
       9 => '9',
-      10 => t('@level - high', array('@level' => '10')),
+      10 => '10 - '. t('severe'),
     ),
-    '#default_value' => (int) variable_get('image_captcha_distortion_amplitude', 0),
+    '#default_value' => (int) variable_get('image_captcha_distortion_amplitude', 6),
     '#description' => t('Set the degree of wave distortion in the image.'),
   );
   $form['image_captcha_distortion_and_noise']['image_captcha_bilinear_interpolation'] = array(
@@ -247,11 +254,14 @@ function image_captcha_settings_form_pre
 
   if ($errno & IMAGE_CAPTCHA_ERROR_NO_TTF_SUPPORT) {
     drupal_set_message(
-      t('The Image CAPTCHA module can not use TrueType fonts because your PHP setup does not support it. You can only use a low quality built-in bitmap font.'),
+      t('The Image CAPTCHA module can not use True Type fonts because your PHP setup does not support it. There is only a built-in bitmap font available.'),
       'warning'
     );
   }
-  elseif ($form['image_captcha_font_settings']['image_captcha_font']['#default_value'] == 'BUILTIN') {
+  else if (count($form['image_captcha_font_settings']['image_captcha_font']['#options']) == 1) {
+    drupal_set_message(t('The image CAPTCHA module works best with a TrueType font file (TTF) for generating the images, but because of licencing issues it is not allowed to package fonts with the module. A simple built-in bitmap font is provided as default instead. You can install TrueType fonts yourself by putting them in the fonts directory of the image CAPTCHA module (directory "%fontsdir") or by uploading them to your Drupal file system (directory "%filesdir") with for example the upload module.', array('%fontsdir' => drupal_get_path('module', 'image_captcha') .'/fonts', '%filesdir' => file_directory_path())), 'warning');
+  }
+  if ($form['image_captcha_font_settings']['image_captcha_font']['#default_value'] == 'BUILTIN') {
     drupal_set_message(t('The usage of the built-in bitmap font it is not recommended because of its small size and missing UTF-8 support.'), 'warning');
   }
   return $form;
