JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
revamped uploaded image handling, added thumbnailing support to metaform
[wfpl.git] / metaform.php
index b2d3c21..04e786a 100644 (file)
@@ -51,7 +51,8 @@ $GLOBALS['types'] = array(
        'rightyesno' => array('checkbox',    'yesno',      'varchar(3)'),
        'yesno' =>      array('leftcheck',   'yesno',      'varchar(3)'),
        'delete' =>     array('checkbox',    'yesno',      'n/a'),
-       'image' =>      array('image',       'oneline',    'varchar(200)'),
+       'image' =>      array('image',       'oneline',    'varchar(120)'),
+       'thumb' =>      array('image',       'oneline',    'varchar(240)'),
        'submit' =>     array('submit',      'oneline',    'n/a')
 );
 
@@ -244,6 +245,9 @@ function make_html($whole_file = true) {
 
                if($GLOBALS['opt_display'] == 'Yes') {
                        switch($input) {
+                               case 'image':
+                                       $tem->show('display_image');
+                               break;
                                case 'checkbox':
                                case 'leftcheck':
                                        $tem->show('display_yesno');
@@ -270,10 +274,15 @@ function make_html($whole_file = true) {
                        if(show_in_listing($type, $input, $format, $sql)) {
                                if($format == 'bool' || $format == 'yesno') {
                                        $tem->set('listing_enc', 'yesno');
+                                       $tem->show('listing_value_enc');
                                } elseif($input == 'date') {
                                        $tem->set('listing_enc', 'mmddyyyy');
+                                       $tem->show('listing_value_enc');
+                               } elseif($type == 'thumb') {
+                                       $tem->show('listing_value_thumb');
                                } else {
                                        $tem->set('listing_enc', 'html');
+                                       $tem->show('listing_value_enc');
                                }
                                $tem->show('listing_head_col');
                                $tem->show('listing_row_col');
@@ -333,11 +342,13 @@ function show_in_listing($type, $input, $format, $sql) {
                case 'textarea':
                case 'html':
                        return false;
-               default:
-                       return true;
        }
-}
+       if($type == 'image') {
+               return false;
+       }
 
+       return true;
+}
 
 function make_php() {
        $tem = new tem();
@@ -364,8 +375,13 @@ function make_php() {
                                $php_fields .= '$' . $name;
                        }
                        if($input == 'image') {
+                               if($type == 'thumb') {
+                                       $tem->show('thumb_settings');
+                                       $tem->show('thumb_upload_params');
+                                       $tem->show('thumb_w_h');
+                               }
+                               $tem->show('image_settings');
                                $tem->show('image_upload');
-                               $tem->show('image_db');
                                if(!$image_included_yet) {
                                        $tem->show('image_include');
                                        $tem->show('upload_max');
@@ -438,7 +454,6 @@ function view_php() {
        echo make_php();
 }
 
-
 function make_email() {
        $tem = new tem();
        $tem->load('code/wfpl/metaform/template.email.txt');
@@ -474,7 +489,6 @@ function view_email() {
        echo make_email();
 }
 
-
 function preview() {
        tem_load('code/wfpl/metaform/preview.html');
        tem_set('file_name', $GLOBALS['file_name']);
@@ -523,5 +537,3 @@ function download_tar() {
 
 metaform();
 exit();
-
-?>