Fixed Activation error due to undefined variable - Some image debugging currently...
authorChuck Scott <cscott@gaslightmedia.com>
Tue, 10 Feb 2015 16:59:49 +0000 (11:59 -0500)
committerChuck Scott <cscott@gaslightmedia.com>
Tue, 10 Feb 2015 16:59:49 +0000 (11:59 -0500)
index.php
lib/GlmDataAbstract/DataAbstract.php
views/admin/member/memberInfo.html

index b370ec6..a4a7e3a 100644 (file)
--- a/index.php
+++ b/index.php
@@ -196,7 +196,7 @@ add_option('glmMembersDatabaseDbVersion', false);
 // Activate
 function glmMembersPluginActivate ()
 {
-    global $wpdb;
+    global $wpdb, $config;
     require_once (GLM_MEMBERS_PLUGIN_PATH . '/activate.php');
     new glmMembersPluginActivate($wpdb, $config);
 }
@@ -205,7 +205,7 @@ register_activation_hook(__FILE__, 'glmMembersPluginActivate');
 // Deactivate
 function glmMembersPluginDeactivate ()
 {
-    global $wpdb;
+    global $wpdb, $config;
     require_once (GLM_MEMBERS_PLUGIN_PATH . '/deactivate.php');
     $x = new glmMembersPluginDeactivate($wpdb, $config);
     return false;
index 4c39a92..39ec4b9 100755 (executable)
@@ -2015,13 +2015,16 @@ abstract class GlmDataAbstract
     }
     function imageInput($as, $f, $id, $idfield, $op)
     {
+echo "DDDDD";
+
+        $haveNewImage = false;
 
         // If this is setup for a new entry, there is no default image capability
         if ($op == 'n') {
             $in = '';
             return $in;
         }
-
+echo "222";
         $current_img = false;
 
         // Setup Image server access
@@ -2048,24 +2051,37 @@ abstract class GlmDataAbstract
             }
         }
 
-        // Is there a new image being uploaded
-        $new = false;
-
-        if (isset($_FILES[$as.'_new']) && is_array($_FILES[$as.'_new']) && $_FILES[$as.'_new']['tmp_name'] != '') {
-            $new = true;
-        }
-
         // If there a request to delete an existing image or a new image and there's a current image
         if (isset($_REQUEST[$as."_delete"]) && ($_REQUEST[$as."_delete"] == 'on' || $new) && $current_img != false) {
 //            $imServer->imageDelete($current_img);
             $current_img = '';
         }
+echo "3333";
+        // Is there a new image being uploaded
+        if (isset($_FILES[$as.'_new']) && is_array($_FILES[$as.'_new']) && $_FILES[$as.'_new']['tmp_name'] != '') {
+
+            $tmpImg = $_FILES[$as.'_new']['tmp_name'];
+
+$imgSize = filesize ( $tmpImg );
+echo "Getting $tmpImg - Size = $imgSize<br>";
+            $newImage = wp_get_image_editor($tmpImg);
+
+            // If we have a good image
+            if ( ! is_wp_error( $newImage ) ) {
 
-        // If there's a new image, try to store that one
-        if ($new) {
+                // Get image temp file name
+                $size = $newImage->get_size();
+echo "Size = $size<br>";
+                $type = $newImage->get_mime_type();
+echo "Type = $type<br>";
+            } else {
 
-//            $current_img = $imServer->imageUpload($as.'_new');
+                if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+                    glmMembersAdmin::addNotice($newImage, 'DataBlock', "DataAbstract - imageInput() wp_get_image_editor($tmpFile) Error");
+                }
 
+echo "Bad image file or some such thing<br>";
+            }
 
         }
 
index 9cf0c86..cab2bbd 100644 (file)
             <tr>
                 <th {if $memberInfo.fieldRequired.logo}class="glm-required"{/if}>Logo:</th>
                 <td {if $memberInfo.fieldFail.logo}class="glm-form-bad-input"{/if}>
-                    <input type="text" name="logo" value="{$memberInfo.fieldData.logo}" class="glm-form-text-input">
+        {if $memberInfo.fieldData.logo}
+                    <img src=""> <input type="checkbox" name="logo_del"> Delete Image<br>
+        {/if}
+                    <input type="file" name="logo_new">
                     {if $memberInfo.fieldFail.logo}<p>{$memberInfo.fieldFail.logo}</p>{/if}
                 </td>
             </tr>
                     {if $memberInfo.fieldFail.notes}<p>{$memberInfo.fieldFail.notes}</p>{/if}
                 </td>
             </tr>
-            <tr>
-                <th {if $memberInfo.fieldRequired.logo}class="glm-required"{/if}>Logo:</th>
-                <td {if $memberInfo.fieldFail.logo}class="glm-form-bad-input"{/if}>
-        {if $memberInfo.fieldData.logo}
-                    <img src=""> <input type="checkbox" name="logo_del"> Delete Image<br>
-        {/if}
-                    <input type="file" name="logo">
-                    {if $memberInfo.fieldFail.logo}<p>{$memberInfo.fieldFail.logo}</p>{/if}
-                </td>
-            </tr>