コード例 #1
0
ファイル: Image.php プロジェクト: jhospina/Project-Egolas
 function __construct($url)
 {
     $this->name = Util::fileExtractName($url);
     $this->extension = strtolower(Util::fileExtractExtension($url));
     $this->path = Util::convertUrltoPath($url);
     $this->route = str_replace($this->name . "." . $this->extension, "", $this->path);
     $this->route_url = str_replace($this->name . "." . $this->extension, "", $url);
     /**
      * La function mime_content_type esta obsoleta
      */
     //$this->mime_type = mime_content_type($this->path);
     $this->mime_type = null;
     $dimensiones = getimagesize($this->path);
     $this->width = $dimensiones[0];
     $this->height = $dimensiones[1];
 }
コード例 #2
0
 public function setStateAttribute($value)
 {
     if (isset($this->attributes[Production::ATTR_STATE])) {
         //Publicacion en redes sociales
         if ($this->attributes[Production::ATTR_STATE] == Production::STATE_PROGRAMMED && $value == Production::STATE_ACTIVE) {
             //PUBLICA EN LA PAGINA DE FACEBOOK LA NUEVA PRODUCCION AGREGADA
             $page_id = "974813252592135";
             $post_url = 'https://graph.facebook.com/' . $page_id . '/feed';
             $page_access_token = 'CAAMlvU2gRHsBAPt2mZBymHkjZChELemLYpyRjMDp6VqjscjB3VwUbGfQsdyuFfNqpFaXZCnvL6ngWorbg6q2V6FP4rrcIUB5dgisdVSr4STFTzecD2zRoOCYFZCei1D6zxNEm0zHZCXr7DFtbMPTIVSioR1sitpGqcV1aTFgZBadL1CVlmbeMk';
             $data['access_token'] = $page_access_token;
             $data['link'] = url("production/" . $this->attributes[Production::ATTR_SLUG]);
             $data['message'] = "¡Hemos agregado recientemente \"" . $this->attributes[Production::ATTR_TITLE] . "\", desde ya puedes disfrutarla online y gratis!";
             $ch = curl_init();
             curl_setopt($ch, CURLOPT_URL, $post_url);
             curl_setopt($ch, CURLOPT_POST, 1);
             curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
             curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
             curl_exec($ch);
             curl_close($ch);
             //PUBLIC EN TWITTER
             $url = $this->attributes[Production::ATTR_IMAGE];
             $path = public_path("assets/db/images/" . Util::fileExtractName($url) . "." . Util::fileExtractExtension($url));
             $uploaded_media = Twitter::uploadMedia(['media' => File::get($path)]);
             @Twitter::postTweet(['status' => "Hemos agregado \"" . $this->attributes[Production::ATTR_TITLE] . "\" ¡Disfrutalo desde ya!", 'media_ids' => $uploaded_media->media_id_string]);
         }
     }
     $this->attributes[Production::ATTR_STATE] = $value;
 }