title: Worpdress unable to display image column from database in wp_list_table
body: <p>My plugin code below, I am having an image column in the database that unable to display image from database as thumbnail image in table record.</p>
  
  <p>How should I do that, can anyone help me.</p>
  
  <p>If you need any other details you can surely ask, I will provide.</p>
  
  <p>Thanks in advance. </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?php
  /*
  Plugin Name: form-test-1
  Author: Ari Parker
  */
  
  if (!class_exists('WP_List_Table')) {
      require_once(ABSPATH . 'wp-admin/includes/class-wp-list-table.php');
  }
  
  /**
   * Custom_Table_Example_List_Table class that will display our custom table
   * records in nice table
   */
  class CC_Custom_Table_Example_List_Table extends WP_List_Table
  {
      /**
       * [REQUIRED] You must declare constructor and give some basic params
       */
      function __construct()
      {
          global $status, $page;
  
          parent::__construct(array(
              'singular' =&gt; 'person',
              'plural' =&gt; 'persons',
          ));
      }
  
      /**
       * [REQUIRED] this is a default column renderer
       *
       * @param $item - row (key, value array)
       * @param $column_name - string (key)
       * @return HTML
       */
      function column_default($item, $column_name)
      {
          return $item[$column_name];
      }
  
      /**
       * [OPTIONAL] this is example, how to render specific column
       *
       * method name must be like this: "column_[column_name]"
       *
       * @param $item - row (key, value array)
       * @return HTML
       */
      function column_age($item)
      {
          return '&lt;em&gt;' . $item['age'] . '&lt;/em&gt;';
      }
  
      /**
       * [OPTIONAL] this is example, how to render column with actions,
       * when you hover row "Edit | Delete" links showed
       *
       * @param $item - row (key, value array)
       * @return HTML
       */
      function column_name($item)
      {
          // links going to /admin.php?page=[your_plugin_page][&amp;other_params]
          // notice how we used $_REQUEST['page'], so action will be done on curren page
          // also notice how we use $this-&gt;_args['singular'] so in this example it will
          // be something like &amp;person=2
          $actions = array(
              'edit' =&gt; sprintf('&lt;a href="?page=persons_form&amp;id=%s"&gt;%s&lt;/a&gt;', $item['id'], __('Edit', 'custom_table_example')),
              'delete' =&gt; sprintf('&lt;a href="?page=%s&amp;action=delete&amp;id=%s"&gt;%s&lt;/a&gt;', $_REQUEST['page'], $item['id'], __('Delete', 'custom_table_example')),
          );
  
          return sprintf('%s %s',
              $item['name'],
              $this-&gt;row_actions($actions)
          );
      }
  
      /**
       * [REQUIRED] this is how checkbox column renders
       *
       * @param $item - row (key, value array)
       * @return HTML
       */
      function column_cb($item)
      {
          return sprintf(
              '&lt;input type="checkbox" name="id[]" value="%s" /&gt;',
              $item['id']
          );
      }
  
      /**
       * [REQUIRED] This method return columns to display in table
       * you can skip columns that you do not want to show
       * like content, or description
       *
       * @return array
       */
      function get_columns()
      {
          $columns = array(
              'cb' =&gt; '&lt;input type="checkbox" /&gt;', //Render a checkbox instead of text
              'name' =&gt; __('Name', 'custom_table_example'),
              'email' =&gt; __('E-Mail', 'custom_table_example'),
       'country' =&gt; __('Country', 'custom_table_example'),
       'photo1_subject' =&gt; __('Photo Subject', 'custom_table_example'),
       'about_yourself' =&gt; __('Description', 'custom_table_example'),
       'create_on' =&gt; __('Created On', 'custom_table_example'),
       
       
       
       
              
          );
          return $columns;
      }
  
      /**
       * [OPTIONAL] This method return columns that may be used to sort table
       * all strings in array - is column names
       * notice that true on name column means that its default sort
       *
       * @return array
       */
      function get_sortable_columns()
      {
          $sortable_columns = array(
              'name' =&gt; array('name', true),
              'email' =&gt; array('email', false),
       'country' =&gt; array('country', false),
       'photo1_subject' =&gt; array('photo1_subject', false),
       'about_yourself' =&gt; array('about_yourself', false),
       'create_on' =&gt; array('create_on', false),
       
       
          );
          return $sortable_columns;
      }
  
      /**
       * [OPTIONAL] Return array of bult actions if has any
       *
       * @return array
       */
      function get_bulk_actions()
      {
          $actions = array(
              'delete' =&gt; 'Delete'
          );
          return $actions;
      }
  
      /**
       * [OPTIONAL] This method processes bulk actions
       * it can be outside of class
       * it can not use wp_redirect coz there is output already
       * in this example we are processing delete action
       * message about successful deletion will be shown on page in next part
       */
      function process_bulk_action()
      {
          global $wpdb;
          $table_name = $wpdb-&gt;prefix . 'form_test_1'; // do not forget about tables prefix
  
          if ('delete' === $this-&gt;current_action()) {
              $ids = isset($_REQUEST['id']) ? $_REQUEST['id'] : array();
              if (is_array($ids)) $ids = implode(',', $ids);
  
              if (!empty($ids)) {
                  $wpdb-&gt;query("DELETE FROM $table_name WHERE id IN($ids)");
              }
          }
      }
  
      /**
       * [REQUIRED] This is the most important method
       *
       * It will get rows from database and prepare them to be showed in table
       */
      function prepare_items()
      {
          global $wpdb;
          $table_name = $wpdb-&gt;prefix . 'form_test_1'; // do not forget about tables prefix
  
          $per_page = 20; // constant, how much records will be shown per page
  
          $columns = $this-&gt;get_columns();
          $hidden = array();
          $sortable = $this-&gt;get_sortable_columns();
  
          // here we configure table headers, defined in our methods
          $this-&gt;_column_headers = array($columns, $hidden, $sortable);
  
          // [OPTIONAL] process bulk action if any
          $this-&gt;process_bulk_action();
  
          // will be used in pagination settings
          $total_items = $wpdb-&gt;get_var("SELECT COUNT(id) FROM $table_name");
  
          // prepare query params, as usual current page, order by and order direction
          $paged = isset($_REQUEST['paged']) ? max(0, intval($_REQUEST['paged']) - 1) : 0;
          $orderby = (isset($_REQUEST['orderby']) &amp;&amp; in_array($_REQUEST['orderby'], array_keys($this-&gt;get_sortable_columns()))) ? $_REQUEST['orderby'] : 'name';
          $order = (isset($_REQUEST['order']) &amp;&amp; in_array($_REQUEST['order'], array('asc', 'desc'))) ? $_REQUEST['order'] : 'asc';
  
          // [REQUIRED] define $items array
          // notice that last argument is ARRAY_A, so we will retrieve array
          $this-&gt;items = $wpdb-&gt;get_results($wpdb-&gt;prepare("SELECT * FROM $table_name ORDER BY $orderby $order LIMIT %d OFFSET %d", $per_page, $paged), ARRAY_A);
  
          // [REQUIRED] configure pagination
          $this-&gt;set_pagination_args(array(
              'total_items' =&gt; $total_items, // total items defined above
              'per_page' =&gt; $per_page, // per page constant defined at top of method
              'total_pages' =&gt; ceil($total_items / $per_page) // calculate pages count
          ));
      }
  }
  
  /**
   * PART 3. Admin page
   * ============================================================================
   *
   * In this part you are going to add admin page for custom table
   *
   * http://codex.wordpress.org/Administration_Menus
   */
  
  /**
   * admin_menu hook implementation, will add pages to list persons_2 and to add new one
   */
  function custom_table_example_admin_menu_2()
  {
      add_menu_page(__('Lomo Form Test 1 Users', 'custom_table_example'), __('Lomo Form Test 1 Users', 'custom_table_example'), 'activate_plugins', 'persons_2', 'custom_table_example_persons_page_handler_2');
      //add_submenu_page('persons_2', __('View List', 'custom_table_example'), __('View List', 'custom_table_example'), 'activate_plugins', 'persons_2', 'custom_table_example_persons_page_handler_2');
      // add new will be described in next part
      //add_submenu_page('persons_2', __('Add new', 'custom_table_example'), __('Add new', 'custom_table_example'), 'activate_plugins', 'persons_form', 'custom_table_example_persons_form_page_handler_2');
  }
  
  add_action('admin_menu', 'custom_table_example_admin_menu_2');
  
  /**
   * List page handler
   *
   * This function renders our custom table
   * Notice how we display message about successfull deletion
   * Actualy this is very easy, and you can add as many features
   * as you want.
   *
   * Look into /wp-admin/includes/class-wp-*-list-table.php for examples
   */
  function custom_table_example_persons_page_handler_2()
  {
      global $wpdb;
  
      $table = new CC_Custom_Table_Example_List_Table();
      $table-&gt;prepare_items();
  
      $message = '';
      if ('delete' === $table-&gt;current_action()) {
          $message = '&lt;div class="updated below-h2" id="message"&gt;&lt;p&gt;' . sprintf(__('Items deleted: %d', 'custom_table_example'), count($_REQUEST['id'])) . '&lt;/p&gt;&lt;/div&gt;';
      }
      ?&gt;
  &lt;div class="wrap"&gt;
  
      &lt;div class="icon32 icon32-posts-post" id="icon-edit"&gt;&lt;br&gt;&lt;/div&gt;
      &lt;h2&gt;&lt;?php _e('Lomo Form Test 1 Users', 'custom_table_example')?&gt; &lt;a class="add-new-h2"
                                   href="&lt;?php echo get_admin_url(get_current_blog_id(), 'admin.php?page=persons_form');?&gt;"&gt;&lt;?php _e('Add new', 'custom_table_example')?&gt;&lt;/a&gt;
      &lt;/h2&gt;
      &lt;?php echo $message; ?&gt;
  
      &lt;form id="persons_2-table" method="GET"&gt;
          &lt;input type="hidden" name="page" value="&lt;?php echo $_REQUEST['page'] ?&gt;"/&gt;
          &lt;?php $table-&gt;display() ?&gt;
      &lt;/form&gt;
  
  &lt;/div&gt;
  &lt;?php
  }
  
  /**
   * PART 4. Form for adding andor editing row
   * ============================================================================
   *
   * In this part you are going to add admin page for adding andor editing items
   * You cant put all form into this function, but in this example form will
   * be placed into meta box, and if you want you can split your form into
   * as many meta boxes as you want
   *
   * http://codex.wordpress.org/Data_Validation
   * http://codex.wordpress.org/Function_Reference/selected
   */
  
  /**
   * Form page handler checks is there some data posted and tries to save it
   * Also it renders basic wrapper in which we are callin meta box render
   */
  function custom_table_example_persons_form_page_handler_2()
  {
      global $wpdb;
      $table_name = $wpdb-&gt;prefix . 'cte'; // do not forget about tables prefix
  
      $message = '';
      $notice = '';
  
      // this is default $item which will be used for new records
      $default = array(
          'id' =&gt; 0,
          'name' =&gt; '',
          'email' =&gt; '',
          'age' =&gt; null,
      );
  
      // here we are verifying does this request is post back and have correct nonce
      if (wp_verify_nonce($_REQUEST['nonce'], basename(__FILE__))) {
          // combine our default item with request params
          $item = shortcode_atts($default, $_REQUEST);
          // validate data, and if all ok save item to database
          // if id is zero insert otherwise update
          $item_valid = custom_table_example_validate_person_2($item);
          if ($item_valid === true) {
              if ($item['id'] == 0) {
                  $result = $wpdb-&gt;insert($table_name, $item);
                  $item['id'] = $wpdb-&gt;insert_id;
                  if ($result) {
                      $message = __('Item was successfully saved', 'custom_table_example');
                  } else {
                      $notice = __('There was an error while saving item', 'custom_table_example');
                  }
              } else {
                  $result = $wpdb-&gt;update($table_name, $item, array('id' =&gt; $item['id']));
                  if ($result) {
                      $message = __('Item was successfully updated', 'custom_table_example');
                  } else {
                      $notice = __('There was an error while updating item', 'custom_table_example');
                  }
              }
          } else {
              // if $item_valid not true it contains error message(s)
              $notice = $item_valid;
          }
      }
      else {
          // if this is not post back we load item to edit or give new one to create
          $item = $default;
          if (isset($_REQUEST['id'])) {
              $item = $wpdb-&gt;get_row($wpdb-&gt;prepare("SELECT * FROM $table_name WHERE id = %d", $_REQUEST['id']), ARRAY_A);
              if (!$item) {
                  $item = $default;
                  $notice = __('Item not found', 'custom_table_example');
              }
          }
      }
  
      // here we adding our custom meta box
      add_meta_box('persons_form_meta_box', 'Person data', 'custom_table_example_persons_form_meta_box_handler_2', 'person', 'normal', 'default');
  
      ?&gt;
  &lt;div class="wrap"&gt;
      &lt;div class="icon32 icon32-posts-post" id="icon-edit"&gt;&lt;br&gt;&lt;/div&gt;
      &lt;h2&gt;&lt;?php _e('Person', 'custom_table_example')?&gt; &lt;a class="add-new-h2"
                                  href="&lt;?php echo get_admin_url(get_current_blog_id(), 'admin.php?page=persons_2');?&gt;"&gt;&lt;?php _e('back to list', 'custom_table_example')?&gt;&lt;/a&gt;
      &lt;/h2&gt;
  
      &lt;?php if (!empty($notice)): ?&gt;
      &lt;div id="notice" class="error"&gt;&lt;p&gt;&lt;?php echo $notice ?&gt;&lt;/p&gt;&lt;/div&gt;
      &lt;?php endif;?&gt;
      &lt;?php if (!empty($message)): ?&gt;
      &lt;div id="message" class="updated"&gt;&lt;p&gt;&lt;?php echo $message ?&gt;&lt;/p&gt;&lt;/div&gt;
      &lt;?php endif;?&gt;
  
      &lt;form id="form" method="POST"&gt;
          &lt;input type="hidden" name="nonce" value="&lt;?php echo wp_create_nonce(basename(__FILE__))?&gt;"/&gt;
          &lt;?php /* NOTICE: here we storing id to determine will be item added or updated */ ?&gt;
          &lt;input type="hidden" name="id" value="&lt;?php echo $item['id'] ?&gt;"/&gt;
  
          &lt;div class="metabox-holder" id="poststuff"&gt;
              &lt;div id="post-body"&gt;
                  &lt;div id="post-body-content"&gt;
                      &lt;?php /* And here we call our custom meta box */ ?&gt;
                      &lt;?php do_meta_boxes('person', 'normal', $item); ?&gt;
                      &lt;input type="submit" value="&lt;?php _e('Save', 'custom_table_example')?&gt;" id="submit" class="button-primary" name="submit"&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/form&gt;
  &lt;/div&gt;
  &lt;?php
  }
  
  /**
   * This function renders our custom meta box
   * $item is row
   *
   * @param $item
   */
  function custom_table_example_persons_form_meta_box_handler_2($item)
  {
      ?&gt;
  
  &lt;table cellspacing="2" cellpadding="5" style="width: 100%;" class="form-table"&gt;
      &lt;tbody&gt;
      &lt;tr class="form-field"&gt;
          &lt;th valign="top" scope="row"&gt;
              &lt;label for="name"&gt;&lt;?php _e('Name', 'custom_table_example')?&gt;&lt;/label&gt;
          &lt;/th&gt;
          &lt;td&gt;
              &lt;input id="name" name="name" type="text" style="width: 95%" value="&lt;?php echo esc_attr($item['name'])?&gt;"
                     size="50" class="code" placeholder="&lt;?php _e('Your name', 'custom_table_example')?&gt;" required&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr class="form-field"&gt;
          &lt;th valign="top" scope="row"&gt;
              &lt;label for="email"&gt;&lt;?php _e('E-Mail', 'custom_table_example')?&gt;&lt;/label&gt;
          &lt;/th&gt;
          &lt;td&gt;
              &lt;input id="email" name="email" type="email" style="width: 95%" value="&lt;?php echo esc_attr($item['email'])?&gt;"
                     size="50" class="code" placeholder="&lt;?php _e('Your E-Mail', 'custom_table_example')?&gt;" required&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr class="form-field"&gt;
          &lt;th valign="top" scope="row"&gt;
              &lt;label for="age"&gt;&lt;?php _e('Age', 'custom_table_example')?&gt;&lt;/label&gt;
          &lt;/th&gt;
          &lt;td&gt;
              &lt;input id="age" name="age" type="number" style="width: 95%" value="&lt;?php echo esc_attr($item['age'])?&gt;"
                     size="50" class="code" placeholder="&lt;?php _e('Your age', 'custom_table_example')?&gt;" required&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
      &lt;/tbody&gt;
  &lt;/table&gt;
  &lt;?php
  }
  
  /**
   * Simple function that validates data and retrieve bool on success
   * and error message(s) on error
   *
   * @param $item
   * @return bool|string
   */
  function custom_table_example_validate_person_2($item)
  {
      $messages = array();
  
      if (empty($item['name'])) $messages[] = __('Name is required', 'custom_table_example');
      if (!empty($item['email']) &amp;&amp; !is_email($item['email'])) $messages[] = __('E-Mail is in wrong format', 'custom_table_example');
      if (!ctype_digit($item['age'])) $messages[] = __('Age in wrong format', 'custom_table_example');
      //if(!empty($item['age']) &amp;&amp; !absint(intval($item['age'])))  $messages[] = __('Age can not be less than zero');
      //if(!empty($item['age']) &amp;&amp; !preg_match('/[0-9]+/', $item['age'])) $messages[] = __('Age must be number');
      //...
  
      if (empty($messages)) return true;
      return implode('&lt;br /&gt;', $messages);
  }
  
  /**
   * Do not forget about translating your plugin, use __('english string', 'your_uniq_plugin_name') to retrieve translated string
   * and _e('english string', 'your_uniq_plugin_name') to echo it
   * in this example plugin your_uniq_plugin_name == custom_table_example
   *
   * to create translation file, use poedit FileNew catalog...
   * Fill name of project, add "." to path (ENSURE that it was added - must be in list)
   * and on last tab add "__" and "_e"
   *
   * Name your file like this: [my_plugin]-[ru_RU].po
   *
   * http://codex.wordpress.org/Writing_a_Plugin#Internationalizing_Your_Plugin
   * http://codex.wordpress.org/I18n_for_WordPress_Developers
   */
  function custom_table_example_languages_2()
  {
      load_plugin_textdomain('custom_table_example', false, dirname(plugin_basename(__FILE__)));
  }
  
  add_action('init', 'custom_table_example_languages_2');</code></pre>
  </div>
  </div>
  </p>