public static function go($obj = array()) { $api = new HtmlSnapShot($obj); return $api->start(); //$api = new Archive($obj); //return $api->archive(); }
public function archive($obj, $snapData = NULL) { //---------------------------------------------------------- //init var //---------------------------------------------------------- $chk = array("bool" => true, 'result' => array(), "func" => "archive"); $hash; //---------------------------------------------------------- //if (!empty($snapData) || !is_null($snapData)) $chk = $this->snap($snapData, $obj['hash']); //--------------------------------------------------------- $compile = $this->getCompile($obj['hash']); //---------------------------------------------------------- if (isset($obj['take_file_name']) && $obj['take_file_name'] == "true") { $obj['projectName'] = $this->getTitle($compile['result'][0]['url']); } //--------------------------------------------------------- if ($compile['bool']) { $prop['hash'] = "{hash}"; $prop['compiles_id'] = $compile['result'][0]['id']; $prop['campaigns_id'] = $obj["campaign_id"]; $prop['name'] = $obj["projectName"]; //----------------------------------------------------- $chk = InsertINTO::go("projects", $prop); $hash = $chk['hash']; //----------------------------------------------------- /*if ($chk['bool']) { $chk = Result::go( "Select '".$chk['result'][0]['url']."' as url, projects.*, compiles.hash From projects, compiles Where projects.compiles_id = compiles.id AND compiles.hash = '".$obj['hash']."'" ); $chk['project_url'] = GenFun::get_full_url(dirname($_SERVER["SCRIPT_FILENAME"]))."/project.php?id=".$hash; }*/ } //--------------------------------------------------------- $hash = $compile['result'][0]['files_hash']; $dir = GlobalMas::$filesPath_absolute . $hash . "/"; //--------------------------------------------------------- $snap = HtmlSnapShot::go(["url" => $compile['result'][0]['url'], "save_path" => $dir . "phantomjs/snap.jpg", "selector" => ".content", "dur" => 10, "snaps" => 10]); //--------------------------------------------------------- return $chk; }