コード例 #1
0
ファイル: SentryUser.php プロジェクト: onlystar1991/mtdb
 /**
  * Uploads provided background and associates with user.
  * 
  * @param  array  $input
  * @param  string $id
  * @return void
  */
 public function uploadBg(array $input, $id)
 {
     $user = User::find($id);
     $path = "avatars/bgs/{$id}.jpg";
     $this->images->saveBg($input, $path);
     $user->background = $path;
     $user->save();
 }
コード例 #2
0
ファイル: TVNetworkRepo.php プロジェクト: onlystar1991/mtdb
 /**
  * Uploads provided cover photo and associates with tv network.
  *
  * @param $logo
  * @param $name
  * @return string
  */
 public function uploadCp($logo, $name)
 {
     $path = "assets/uploads/tv-networks/cover-photos/" . time() . '-' . $name . '-cover-photo' . '.jpg';
     $this->images->saveBg($logo, $path);
     return $path;
 }
コード例 #3
0
ファイル: ImdbActorData.php プロジェクト: samirios1/niter
 /**
  * Gets titles actor is know for.
  * 
  * @return array.
  */
 public function getKnownFor()
 {
     if (!$this->knownFor) {
         //grab all the titles actor is know for
         $known = $this->crawler->filter('div#knownfor > div');
         //extract id, title, poster for each one and make multidim array from it
         foreach ($known as $k => $v) {
             $crawler = new crawler($v);
             $imdbid = $this->id($crawler->filter('a')->extract('href'));
             $title = head($crawler->filter('a > img')->extract('title'));
             $poster = $this->image($crawler->filter('a > img')->extract('src'), $imdbid);
             $year = Helpers::extractYear(head($crawler->filter('a')->eq(1)->extract('_text')));
             $this->knownFor[] = array('imdb_id' => $imdbid, 'title' => $title, 'poster' => $poster, 'year' => $year);
         }
     }
     $this->images->saveMultiple($this->imgUrls, null, 'imdb/posters/');
     return $this->knownFor;
 }