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


PHP createIconGD函数代码示例

本文整理汇总了PHP中createIconGD函数的典型用法代码示例。如果您正苦于以下问题:PHP createIconGD函数的具体用法?PHP createIconGD怎么用?PHP createIconGD使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: createIcon

function createIcon($file)
{
    // @todo: Add support for others methods.
    if (class_exists("Imagick")) {
        $img = new Imagick();
        $img->readImageBlob(file_get_contents($file));
        $img->thumbnailImage(100, 100, true);
        return base64_encode($img);
    } elseif (extension_loaded('gd')) {
        return createIconGD($file);
    } else {
        return giftThumbnail();
    }
}
开发者ID:diamondobama,项目名称:WhatsAPI,代码行数:14,代码来源:func.php

示例2: sendSetPicture

 /**
  * Set your profile picture
  *
  * @param string $jid
  * @param string $filepath
  *  URL or localpath to image file
  */
 protected function sendSetPicture($jid, $filepath)
 {
     if (stripos($filepath, 'http') !== false && !preg_match('/\\s/', $filepath)) {
         $extension = end(explode(".", $filepath));
         $newImageName = rand(0, 100000);
         $imagePath = static::PICTURES_FOLDER . "/" . $newImageName . ".jpg";
         if ($extension == 'jpg') {
             copy($filepath, $imagePath);
             $filepath = $imagePath;
         }
     }
     preprocessProfilePicture($filepath);
     $fp = @fopen($filepath, "r");
     if ($fp) {
         $data = fread($fp, filesize($filepath));
         if ($data) {
             //this is where the fun starts
             $picture = new ProtocolNode("picture", null, null, $data);
             $icon = createIconGD($filepath, 96, true);
             $thumb = new ProtocolNode("picture", array("type" => "preview"), null, $icon);
             $hash = array();
             $nodeID = $this->createMsgId("setphoto");
             $hash["id"] = $nodeID;
             $hash["to"] = $this->getJID($jid);
             $hash["type"] = "set";
             $hash["xmlns"] = "w:profile:picture";
             $node = new ProtocolNode("iq", $hash, array($picture, $thumb), null);
             $this->sendNode($node);
             $this->waitForServer($nodeID);
         }
     }
 }
开发者ID:micschk,项目名称:WhatsAPI,代码行数:39,代码来源:whatsprot.class.php

示例3: sendSetPicture

 /**
  * Set your profile picture
  *
  * @param string $jid
  * @param string $filepath
  *  URL or localpath to image file
  */
 protected function sendSetPicture($jid, $filepath)
 {
     preprocessProfilePicture($filepath);
     $fp = @fopen($filepath, "r");
     if ($fp) {
         $data = fread($fp, filesize($filepath));
         if ($data) {
             //this is where the fun starts
             $picture = new ProtocolNode("picture", null, null, $data);
             $icon = createIconGD($filepath, 96, true);
             $thumb = new ProtocolNode("picture", array("type" => "preview"), null, $icon);
             $hash = array();
             $nodeID = $this->createMsgId("setphoto");
             $hash["id"] = $nodeID;
             $hash["to"] = $this->getJID($jid);
             $hash["type"] = "set";
             $hash["xmlns"] = "w:profile:picture";
             $node = new ProtocolNode("iq", $hash, array($picture, $thumb), null);
             $this->sendNode($node);
             $this->waitForServer($nodeID);
         }
     }
 }
开发者ID:nekulin,项目名称:WhatsAPI,代码行数:30,代码来源:whatsprot.class.php

示例4: sendSetPicture

 /**
  * Set your profile picture
  *
  * @param string $jid
  * @param string $filepath URL or localpath to image file
  */
 protected function sendSetPicture($jid, $filepath)
 {
     $nodeID = $this->createIqId();
     $data = preprocessProfilePicture($filepath);
     $preview = createIconGD($filepath, 96, true);
     $picture = new ProtocolNode("picture", array("type" => "image"), null, $data);
     $preview = new ProtocolNode("picture", array("type" => "preview"), null, $preview);
     $node = new ProtocolNode("iq", array('id' => $nodeID, 'to' => $this->getJID($jid), 'type' => 'set', 'xmlns' => 'w:profile:picture'), array($picture, $preview), null);
     $this->sendNode($node);
     $this->waitForServer($nodeID);
 }
开发者ID:rezanadimi72,项目名称:Chat-API,代码行数:17,代码来源:whatsprot.class.php

示例5: createVideoIcon

function createVideoIcon($file)
{
    /* should install ffmpeg for the method to work successfully  */
    if (checkFFMPEG()) {
        //generate thumbnail
        $preview = sys_get_temp_dir() . '/' . md5($file) . '.jpg';
        @unlink($preview);
        //capture video preview
        $command = "ffmpeg -i \"" . $file . "\" -f mjpeg -ss 00:00:01 -vframes 1 \"" . $preview . "\"";
        exec($command);
        return createIconGD($preview);
    } else {
        return base64_decode(videoThumbnail());
    }
}
开发者ID:sangupandi,项目名称:WhatsAPI-Official,代码行数:15,代码来源:func.php

示例6: createVideoIcon

function createVideoIcon($file)
{
    // @todo: Add support for video thumbnail create.
    // @see: http://stackoverflow.com/questions/14662027/generate-thumbnail-for-a-bunch-of-mp4-video-in-a-folder
    //return giftThumbnail();
    /* should install ffmpeg for the method to work successfully  */
    if (checkFFMPEG()) {
        //generate thumbnail
        $preview = sys_get_temp_dir() . '/' . md5($file) . '.jpg';
        @unlink($preview);
        //capture video preview
        $command = "ffmpeg -i \"" . $file . "\" -f image2 -vframes 1 \"" . $preview . "\"";
        exec($command);
        // Parsear la imagen
        //TODO: Make it work using libGD (see createIcon())
        return createIconGD($preview);
    } else {
        //fallback
        return giftThumbnail();
    }
}
开发者ID:gopalmali,项目名称:WhatsAPI,代码行数:21,代码来源:func.php

示例7: sendSetPicture

 /**
  * Set your profile picture.
  *
  * @param string $jid
  * @param string $filepath URL or localpath to image file
  */
 protected function sendSetPicture($jid, $filepath)
 {
     $nodeID = $this->createIqId();
     $data = preprocessProfilePicture($filepath);
     $preview = createIconGD($filepath, 96, true);
     $picture = new ProtocolNode('picture', ['type' => 'image'], null, $data);
     $preview = new ProtocolNode('picture', ['type' => 'preview'], null, $preview);
     $node = new ProtocolNode('iq', ['id' => $nodeID, 'to' => $this->getJID($jid), 'type' => 'set', 'xmlns' => 'w:profile:picture'], [$picture, $preview], null);
     $this->sendNode($node);
 }
开发者ID:Veivan,项目名称:WABuh,代码行数:16,代码来源:whatsprot.class.php

示例8: sendSetPicture

 /**
  * Set your profile picture
  *
  * @param string $jid
  * @param string $filepath
  *  URL or localpath to image file
  */
 protected function sendSetPicture($jid, $filepath)
 {
     $data = preprocessProfilePicture($filepath);
     $preview = createIconGD($filepath, 96, true);
     $picture = new ProtocolNode("picture", array("type" => "image"), null, $data);
     $preview = new ProtocolNode("picture", array("type" => "preview"), null, $preview);
     $hash = array();
     $nodeID = $this->createMsgId("setphoto");
     $hash["id"] = $nodeID;
     $hash["to"] = $this->getJID($jid);
     $hash["type"] = "set";
     $hash["xmlns"] = "w:profile:picture";
     $node = new ProtocolNode("iq", $hash, array($picture, $preview), null);
     $this->sendNode($node);
     $this->waitForServer($nodeID);
 }
开发者ID:ankurdebnath,项目名称:WebProjects,代码行数:23,代码来源:whatsprot.class.php


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