Exemplo n.º 1
0
 public function getThumbnail()
 {
     $url = $this->_getMixcloudUrl();
     if ($url) {
         $html = Curl::get($url);
         $matches = array();
         preg_match('%og:image\\" content=\\"(.+?)\\"%', $html, $matches);
         // we get .png, we want .jpg
         if (isset($matches[1])) {
             return $matches[1];
         }
         return null;
     }
     return null;
 }
Exemplo n.º 2
0
 public function getThumbnail()
 {
     $vmid = $this->_getVimeoId();
     if ($vmid) {
         $response = Curl::get("http://vimeo.com/api/v2/video/{$vmid}.php");
         try {
             $hash = unserialize($response);
         } catch (Exception $e) {
             Log::logException(new AjdeException("Could not parse result from Vimeo"));
             return null;
         }
         return $hash[0]['thumbnail_large'];
     }
     return null;
 }
Exemplo n.º 3
0
 public function getThumbnail()
 {
     if (substr($this->_code, 0, 7) == 'http://' || substr($this->_code, 0, 8) == 'https://') {
         $apiUrl = 'http://api.soundcloud.com/resolve.json?url=' . urlencode($this->_code) . '&client_id=' . $this->_key();
         $hash = json_decode(Curl::get($apiUrl));
         return str_replace('large.jpg', 't300x300.jpg', $hash->artwork_url);
     } else {
         $url = $this->_getSoundcloudUrl();
         if ($url) {
             $apiUrl = $url . '.json?client_id=' . $this->_key();
             $hash = json_decode(Curl::get($apiUrl));
             return str_replace('large.jpg', 't300x300.jpg', $hash->artwork_url);
         }
     }
     return null;
 }
Exemplo n.º 4
0
 private function web2pdf($url, $filename = null)
 {
     $web2pdfRoot = Config::get('pdfWeb2PdfApi');
     $api = $web2pdfRoot . '?url=' . urlencode($url) . '&filename=' . urlencode($filename);
     return Curl::get($api);
 }
Exemplo n.º 5
0
 /**
  * @param string $html
  * @return mixed
  */
 public static function inlineCss($html)
 {
     $url = 'https://inlinestyler.torchbox.com:443/styler/convert/';
     $data = array('returnraw' => '1', 'source' => $html);
     return Curl::post($url, $data);
 }
Exemplo n.º 6
0
 public function downloadUpdate()
 {
     // store in tmp dir
     $url = $this->getAvailablePackageURL();
     $file = $this->getPackageFile();
     if (is_file($file)) {
         unlink($file);
     }
     return Curl::download($url, $file);
 }