Example #1
0
 /**
  * 删除图片与数据
  * @param photo 照片记录
  */
 public function delete_image($photo)
 {
     $file = $photo['full_path'];
     $file_thumbnail = get_userdir($this->session->user['id']) . 'thumbnail_500/' . $photo['filename'] . '_500.jpg';
     $this->db->trans_begin();
     try {
         if (unlink($file) && unlink($file_thumbnail)) {
             $this->db->delete($this->table, array('id' => $photo['id']));
             $this->db->trans_commit();
             return true;
         } else {
             $this->db->trans_rollback();
             return false;
         }
     } catch (Exception $e) {
         $this->db->trans_rollback();
     }
     return false;
 }
Example #2
0
 public function test()
 {
     echo get_userdir(2);
     echo '<br>';
     echo get_asset_userdir(2);
 }