Example #1
0
 public static function create($name, $file)
 {
     $obj = new self();
     $obj->name = $name;
     $obj->file = "0";
     $tx = new Transaction();
     try {
         global $db_con;
         qdb("INSERT INTO `PREFIX_images` (`name`, `file`) VALUES (?, '0')", $name);
         $obj->id = $db_con->lastInsertId();
         $obj->exchange_image($file);
         $tx->commit();
     } catch (Exception $e) {
         $tx->rollback();
         throw $e;
     }
     return $obj;
 }