private function curl_contents($url) { $cookie_file = $this->cookie($url); $ch = curl_init(); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_ENCODING, "utf-8"); // curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); // curl_setopt($ch, CURLOPT_USERAGENT, "facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)"); curl_setopt($ch, CURLOPT_USERAGENT, dp_base("{site_name}{module_dir}") . "1.0 (+" . dp_base("{host}{module_dir}ajax?act=link") . ")"); curl_setopt($ch, CURLOPT_COOKIESESSION, true); curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file); curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file); $data = curl_exec($ch); curl_close($ch); return $data; }
private function format_image($id) { if ($this->image === false) { return; } $fu = new \upload_photo(); $fu->upload_dir = dp_base("{root}{publicfiles}{module_dir}{$id}/"); $fu->foto_folder = dp_base("{root}{publicfiles}{module_dir}{$id}/{images}"); $fu->thumb_folder = dp_base("{root}{publicfiles}{module_dir}{$id}/{thumbs}"); $fu->extensions = array(".jpg", ".jpeg", ".gif", ".png"); $fu->language = "en"; $fu->x_max_size = dp_prop("upload.image.xmax.size"); $fu->y_max_size = dp_prop("upload.image.ymax.size"); $fu->x_max_thumb_size = $this->conf['thx']; $fu->y_max_thumb_size = $this->conf['thy']; $fu->rename_file = false; $fu->file_copy = $this->image; $fu->process_image(true, true, false, 80); }