Esempio n. 1
0
 public function snap($img, $hash)
 {
     //----------------------------------------------------------
     //init var
     //----------------------------------------------------------
     $chk = array("bool" => true, 'result' => array(), "func" => "snap");
     //----------------------------------------------------------
     $chk = CreateImage::go($img, array("dir" => GlobalMas::$filesPath_absolute . $hash));
     //----------------------------------------------------------
     print_r($chk);
     if ($chk['bool']) {
         $name = explode("/", $chk['result']);
         $name = array_pop($name);
     }
     //----------------------------------------------------------
     if ($chk['bool']) {
         $chk = InsertINTO::go("files", array('name' => $name, "hash" => '{hash}'));
     } else {
         return $chk;
     }
     //----------------------------------------------------------
     return $chk;
 }
Esempio n. 2
0
 public function updateImg($img, $info)
 {
     //----------------------------------------------------------
     //init var
     //----------------------------------------------------------
     $chk = array("bool" => true, 'result' => array(), "func" => "updateImg");
     //----------------------------------------------------------
     $chk = CreateImage::go($img, array("dir" => $this->thumbRelPath));
     //----------------------------------------------------------
     if ($chk['bool']) {
         $name = explode("/", $chk['result']);
         $name = array_pop($name);
     }
     //----------------------------------------------------------
     if ($chk['bool']) {
         $chk = $this->insertFile($name, json_encode($upload["files"]));
     } else {
         return $chk;
     }
     //----------------------------------------------------------
     if ($chk['bool']) {
         $chk = Update::go("videos", array("images_id" => $chk['insert_id']), array("id" => $info['id']));
     } else {
         return $chk;
     }
     //----------------------------------------------------------
     if ($chk['bool']) {
         $chk['message'] = "Thumbnal for '" . $info['title'] . "' has been changed successfully!!!";
     }
     //----------------------------------------------------------
     return $chk;
 }