// Set the thumbnailHeight to the current thumbnailSize
                   // Set the thumbnailWidth to the appropriate size based on the thumbnailHeight * ratio
                   $image_data = @getimagesize($tmpFile);
+                  if(!$image_data) {
+                    return array(GalleryCoreApi::error(ERROR_STORAGE_FAILURE,__FILE__,__LINE__,
+                           "Unable to retrieve thumbnail dimensions for: $tmpFile"),null,null);
+                  }
                   $ratio = $image_data[0] / $image_data[1];
                   $debugString.="Using ratio from original thumbnail of $ratio. ";
                   $thumbnailHeight=$thumbnailSize;