当前位置: 首页>>代码示例>>PHP>>正文


PHP Picture::set方法代码示例

本文整理汇总了PHP中Picture::set方法的典型用法代码示例。如果您正苦于以下问题:PHP Picture::set方法的具体用法?PHP Picture::set怎么用?PHP Picture::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Picture的用法示例。


在下文中一共展示了Picture::set方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ajaxSubmit

 function ajaxSubmit($avatar)
 {
     $p = new \Picture();
     $p->fromBase((string) $avatar->photobin->value);
     $p->set($this->user->getLogin());
     $r = new Set();
     $r->setData($avatar->photobin->value)->request();
 }
开发者ID:christine-ho-dev,项目名称:movim,代码行数:8,代码来源:Avatar.php

示例2: ajaxSubmit

 function ajaxSubmit($avatar)
 {
     $p = new \Picture();
     $p->fromBase($avatar->photobin->value);
     $p->set('temp', 'jpeg', 60);
     $p = new \Picture();
     $p->get('temp');
     $r = new Set();
     $r->setData($p->toBase())->request();
 }
开发者ID:Anon215,项目名称:movim,代码行数:10,代码来源:Avatar.php

示例3: handle

 public function handle($stanza, $parent = false)
 {
     $jid = current(explode('/', (string) $parent->attributes()->from));
     $evt = new \Event();
     $cd = new \modl\ContactDAO();
     $c = $cd->get($jid);
     if ($c == null) {
         $c = new \modl\Contact();
     }
     $p = new \Picture();
     $p->fromBase((string) $stanza->items->item->data);
     $p->set($jid);
     $evt->runEvent('vcard', $c);
 }
开发者ID:Hywan,项目名称:moxl,代码行数:14,代码来源:Avatar.php

示例4: getList

 function getList($params = NULL, $proyection = '*', $order = '1', $limit = '')
 {
     if ($this->db != NULL) {
         $this->db->read($this->table, $proyection, $params);
         $r = array();
         while ($param = $this->db->getRow()) {
             $picture = new Picture();
             $picture->set($param);
             $r[] = $picture;
         }
         return $r;
     }
     return NULL;
 }
开发者ID:developdms,项目名称:Practica-5,代码行数:14,代码来源:ManagerPicture.php

示例5: ajaxSend

 function ajaxSend($to, $pack, $file)
 {
     if (!$this->validateJid($to)) {
         return;
     }
     list($key, $ext) = explode('.', $file);
     $filepath = dirname(__FILE__) . '/stickers/' . $pack . '/' . $key . '.png';
     if (!file_exists($filepath)) {
         return;
     }
     // We get the base64
     $base64 = base64_encode(file_get_contents($filepath));
     // Caching the picture
     if (!file_exists(CACHE_PATH . md5($key) . '.png')) {
         $p = new Picture();
         $p->fromBase($base64);
         $p->set($key, 'png');
     }
     // Creating a message
     $m = new \Modl\Message();
     $m->session = $this->user->getLogin();
     $m->jidto = echapJid($to);
     $m->jidfrom = $this->user->getLogin();
     $m->sticker = $key;
     $m->body = $this->__('sticker.sent');
     $m->published = gmdate('Y-m-d H:i:s');
     $session = \Session::start();
     $m->id = Uuid::uuid4();
     $m->type = 'chat';
     $m->resource = $session->get('resource');
     // Sending the sticker
     $html = "<p><img alt='Sticker' src='cid:sha1+" . $key . "@bob.xmpp.org'/></p>";
     $p = new Publish();
     $p->setTo($m->jidto)->setContent($m->body)->setHTML($html)->setId($m->id)->request();
     $md = new \Modl\MessageDAO();
     $md->set($m);
     // Sending it to Chat
     $packet = new Moxl\Xec\Payload\Packet();
     $packet->content = $m;
     $c = new Chat();
     $c->onMessage($packet);
 }
开发者ID:Anon215,项目名称:movim,代码行数:42,代码来源:Stickers.php

示例6: createThumbnails

 public function createThumbnails()
 {
     $p = new \Picture();
     $p->fromBase($this->photobin);
     $p->set($this->jid);
     if (isset($this->email)) {
         \createEmailPic(strtolower($this->jid), $this->email);
     }
 }
开发者ID:sugaryog,项目名称:movim,代码行数:9,代码来源:Contact.php

示例7: set

 public function set($stanza, $parent = false)
 {
     if ($stanza->body || $stanza->subject) {
         $jid = explode('/', (string) $stanza->attributes()->from);
         $to = current(explode('/', (string) $stanza->attributes()->to));
         if (isset($stanza->attributes()->id)) {
             $this->id = (string) $stanza->attributes()->id;
         }
         // This is not very beautiful
         $user = new \User();
         $this->session = $user->getLogin();
         $this->jidto = $to;
         $this->jidfrom = $jid[0];
         if (isset($jid[1])) {
             $this->__set('resource', $jid[1]);
         }
         $this->type = 'chat';
         if ($stanza->attributes()->type) {
             $this->type = (string) $stanza->attributes()->type;
         }
         if ($stanza->body) {
             $this->__set('body', (string) $stanza->body);
         }
         if ($stanza->subject) {
             $this->__set('subject', (string) $stanza->subject);
         }
         if ($stanza->html) {
             $xml = \simplexml_load_string((string) $stanza->html->body);
             if ($xml) {
                 $results = $xml->xpath('//img/@src');
                 if (is_array($results) && !empty($results)) {
                     if (substr((string) $results[0], 0, 10) == 'data:image') {
                         $str = explode('base64,', $results[0]);
                         if (isset($str[1])) {
                             $p = new \Picture();
                             $p->fromBase(urldecode($str[1]));
                             $key = sha1(urldecode($str[1]));
                             $p->set($key, 'png');
                             $this->sticker = $key;
                         }
                     } else {
                         $this->sticker = getCid((string) $results[0]);
                     }
                 }
             }
         }
         if ($stanza->replace) {
             $this->newid = $this->id;
             $this->id = (string) $stanza->replace->attributes()->id;
             $this->edited = true;
         }
         if ($stanza->delay) {
             $this->published = gmdate('Y-m-d H:i:s', strtotime($stanza->delay->attributes()->stamp));
         } elseif ($parent && $parent->delay) {
             $this->published = gmdate('Y-m-d H:i:s', strtotime($parent->delay->attributes()->stamp));
         } else {
             $this->published = gmdate('Y-m-d H:i:s');
         }
         $this->checkPicture();
     }
 }
开发者ID:Anon215,项目名称:movim,代码行数:61,代码来源:Message.php

示例8: dirname

<?php

define('DOCUMENT_ROOT', dirname(__FILE__));
require_once DOCUMENT_ROOT . '/bootstrap.php';
$bootstrap = new Bootstrap();
$booted = $bootstrap->boot();
$sFileName = $_FILES['image_file']['name'];
$sFileType = $_FILES['image_file']['type'];
$error = $_FILES['image_file']['error'];
$user = new User();
if ($error == UPLOAD_ERR_OK && $user->dirSize() < $user->sizelimit) {
    $tmp_name = $_FILES["image_file"]["tmp_name"];
    if (getimagesize($tmp_name) != 0) {
        $name = stringToUri($_FILES["image_file"]["name"]);
        move_uploaded_file($tmp_name, $user->userdir . $name);
        $p = new \Picture();
        $p->fromPath($user->userdir . $name);
        $p->set($user->userdir . $name);
    } else {
        unlink($tmp_name);
        echo '<div class="message error">' . t('Not a picture') . '</div>';
    }
} else {
    echo '<div class="message error">' . t('Folder size limit exceeded') . '</div>';
}
开发者ID:Nyco,项目名称:movim,代码行数:25,代码来源:upload.php

示例9: setPicture

 public function setPicture()
 {
     $pd = new \Modl\PostnDAO();
     $item = $pd->getGroupPicture($this->server, $this->node);
     if ($item) {
         $item->getAttachments();
         $p = new \Picture();
         if ($item->getPublicUrl()) {
             try {
                 $embed = \Embed\Embed::create($item->getPublicUrl());
                 // We get the icon
                 $url = false;
                 foreach ($embed->providerIcons as $icon) {
                     if ($icon['mime'] != 'image/x-icon') {
                         $url = $icon['value'];
                     }
                 }
                 // If not we take the main picture
                 if (!$url) {
                     $url = (string) $embed->image;
                 }
                 // If not we take the post picture
                 if (!$url) {
                     $url = (string) $item->picture;
                 }
                 $p->fromURL($url);
                 if ($p->set($this->server . $this->node)) {
                     $this->logo = true;
                 }
             } catch (\Exception $e) {
                 error_log($e->getMessage());
             }
         }
     }
 }
开发者ID:Anon215,项目名称:movim,代码行数:35,代码来源:Item.php


注:本文中的Picture::set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。