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


PHP imagexbm函数代码示例

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


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

示例1: imagexbm

 /**
  * Fix imagexbm bug where the output stream is still sent to stdout (https://bugs.php.net/bug.php?id=66339)
  *
  * @return void
  **/
 protected function imagexbm($output, $outputPath = null, $foreground = null)
 {
     if ($outputPath) {
         ob_start();
         imagexbm($output, $outputPath, $foreground);
         $data = ob_get_contents();
         ob_end_clean();
         file_put_contents($outputPath, $data, LOCK_EX);
     } else {
         imagexbm($output, $outputPath, $foreground);
     }
 }
开发者ID:moust,项目名称:paint,代码行数:17,代码来源:XBM.php

示例2: save

 /**
  * Save image to disk
  *
  * @param string $file The path of the file will be save to
  *
  * @return bool Return true when saved, false for fail
  */
 public function save($file)
 {
     if ($this->imageRes) {
         if (!file_exists($file)) {
             switch ($this->imageInfo['Type']) {
                 case IMAGETYPE_GIF:
                     return imagegif($this->imageRes, $file);
                     break;
                 case IMAGETYPE_JPEG:
                     return imagejpeg($this->imageRes, $file, 85);
                     break;
                 case IMAGETYPE_PNG:
                     return imagepng($this->imageRes, $file);
                     break;
                 case IMAGETYPE_WBMP:
                     return imagewbmp($this->imageRes, $file);
                     break;
                 case IMAGETYPE_XBM:
                     return imagexbm($this->imageRes, $file);
                     break;
                 default:
                     $this->error = 'ERROR_IMAGE_HANDLER_IMAGE_INVALID';
                     return false;
                     break;
             }
         } else {
             $this->error = 'ERROR_IMAGE_HANDLER_SAVE_FILEEXISTED';
         }
     } else {
         $this->error = 'ERROR_IMAGE_HANDLER_IMAGE_NOTLOAD';
     }
     return false;
 }
开发者ID:BGCX067,项目名称:faculaframework2-git,代码行数:40,代码来源:GD.php

示例3: imagewbmp

            break;
        case 'JPX':
            // TODO JPX Support
            break;
        case 'JB2':
            // TODO JB2 Support
            break;
        case 'SWC':
            // TODO SWC Support
            break;
        case 'IFF':
            // TODO IFF Support
            break;
        case 'WBMP':
            if (isset($Call['ID'])) {
                imagewbmp($Call['Image']['Object'], $Call['ID']);
            } else {
                imagewbmp($Call['Image']['Object']);
            }
            break;
        case 'XBM':
            imagexbm($Call['Image']['Object'], $Call['ID']);
            break;
        case 'ICO':
            // TODO ICO Support
            break;
    }
    // TODO WEBP Support
    // TODO TGA Support
    return $Call;
});
开发者ID:trickyplan,项目名称:codeine,代码行数:31,代码来源:GD2.php

示例4: _render

 protected function _render($ext, $quality)
 {
     ob_start();
     if (strcasecmp($ext, "gif") == 0) {
         imagegif($this->_image);
         return ob_get_clean();
     }
     if (strcmp($ext, "jpg") == 0 || strcmp($ext, "jpeg") == 0) {
         imagejpeg($this->_image, null, $quality);
         return ob_get_clean();
     }
     if (strcmp($ext, "png") == 0) {
         imagejpeg($this->_image);
         return ob_get_clean();
     }
     if (strcmp($ext, "wbmp") == 0) {
         imagewbmp($this->_image);
         return ob_get_clean();
     }
     if (strcmp($ext, "xbm") == 0) {
         imagexbm($this->_image, null);
         return ob_get_clean();
     }
     throw new Exception("Installed GD does not support '" . $ext . "' images");
 }
开发者ID:smallmirror62,项目名称:framework,代码行数:25,代码来源:Gd.php

示例5: output

 /**
  * Output an image
  *
  * @param   resource handle
  * @return  bool
  */
 public function output($handle)
 {
     return imagexbm($handle, '', $this->foreground);
 }
开发者ID:xp-framework,项目名称:imaging,代码行数:10,代码来源:XbmStreamWriter.class.php

示例6: print_thumbnail


//.........这里部分代码省略.........
                 $thumbnail = @imagerotate($thumbnail, 90, imagecolorallocate($thumbnail, 255, 255, 255));
                 break;
             case 6:
                 // 90 rotate right
                 $thumbnail = @imagerotate($thumbnail, -90, imagecolorallocate($thumbnail, 255, 255, 255));
                 break;
             case 7:
                 // mirror horizontal, 90 rotate right
                 @imageflip($thumbnail, IMG_FLIP_HORIZONTAL);
                 $thumbnail = @imagerotate($thumbnail, -90, imagecolorallocate($thumbnail, 255, 255, 255));
                 break;
             case 8:
                 // 90 rotate left
                 $thumbnail = @imagerotate($thumbnail, 90, imagecolorallocate($thumbnail, 255, 255, 255));
                 break;
         }
     }
     //Cache it
     if ($this->is_cacheable()) {
         switch ($format) {
             case 1:
                 $cached = @imagegif($thumbnail, $cache_file);
                 break;
             case 2:
                 $cached = @imageJPEG($thumbnail, $cache_file, 100);
                 break;
             case 3:
                 $cached = @imagepng($thumbnail, $cache_file);
                 break;
             case 15:
                 $cached = @imagewbmp($thumbnail, $cache_file);
                 break;
             case 16:
                 $cached = @imagexbm($thumbnail, $cache_file);
                 break;
             default:
                 $cached = false;
         }
         if (!$cached) {
             return $this->set_error("Method print_thumbnail 1: Error in cache generation of image '{$image}'.");
         }
     }
     if ($target_file != false) {
         $wrappers = stream_get_wrappers();
         $wrappers_re = '(' . implode('|', $wrappers) . ')';
         $isStream = preg_match("!^{$wrappers_re}://!", $target_file) === 1;
         if ($isStream) {
             $backToStreamTarget = $target_file;
             $target_file = tempnam(AJXP_Utils::getAjxpTmpDir(), "pthumb_");
         }
         switch ($format) {
             case 1:
                 $cached = @imagegif($thumbnail, $target_file);
                 break;
             case 2:
                 $cached = @imageJPEG($thumbnail, $target_file, 100);
                 break;
             case 3:
                 $cached = @imagepng($thumbnail, $target_file);
                 break;
             case 15:
                 $cached = @imagewbmp($thumbnail, $target_file);
                 break;
             case 16:
                 $cached = @imagexbm($thumbnail, $target_file);
                 break;
开发者ID:rbrdevs,项目名称:pydio-core,代码行数:67,代码来源:PThumb.lib.php

示例7: _output

 /**
  * @brief Outputs/saves the image.
  */
 private function _output($filepath = null)
 {
     if ($filepath) {
         if (!file_exists(dirname($filepath))) {
             mkdir(dirname($filepath), 0777, true);
         }
         if (!is_writable(dirname($filepath))) {
             OC_Log::write('core', __METHOD__ . '(): Directory \'' . dirname($filepath) . '\' is not writable.', OC_Log::ERROR);
             return false;
         } elseif (is_writable(dirname($filepath)) && file_exists($filepath) && !is_writable($filepath)) {
             OC_Log::write('core', __METHOD__ . '(): File \'' . $filepath . '\' is not writable.', OC_Log::ERROR);
             return false;
         }
     }
     if (!$this->valid()) {
         return false;
     }
     $retval = false;
     switch ($this->imagetype) {
         case IMAGETYPE_GIF:
             $retval = imagegif($this->resource, $filepath);
             break;
         case IMAGETYPE_JPEG:
             $retval = imagejpeg($this->resource, $filepath);
             break;
         case IMAGETYPE_PNG:
             $retval = imagepng($this->resource, $filepath);
             break;
         case IMAGETYPE_XBM:
             $retval = imagexbm($this->resource, $filepath);
             break;
         case IMAGETYPE_WBMP:
             $retval = imagewbmp($this->resource, $filepath);
             break;
         case IMAGETYPE_BMP:
             $retval = imagebmp($this->resource, $filepath, $this->bit_depth);
             break;
         default:
             $retval = imagepng($this->resource, $filepath);
     }
     return $retval;
 }
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:45,代码来源:image.php

示例8: imagesavealpha

                     imagesavealpha($new_image, TRUE);
                     switch ($page->getMimeType()) {
                         case 'image/gif':
                             imagegif($new_image);
                             break;
                         case 'image/jpeg':
                             imagejpeg($new_image);
                             break;
                         case 'image/png':
                             imagepng($new_image);
                             break;
                         case 'image/vnd.wap.wbmp':
                             imagewbmp($new_image);
                             break;
                         case 'image/x-xbitmap':
                             imagexbm($new_image);
                             break;
                         default:
                             throw new Exception(sprintf('unhandled image type: %s', $page->getMimeType()));
                     }
                     imagedestroy($new_image);
                 } else {
                     echo $page->object->data;
                 }
             } else {
                 // {{{2
                 throw new Exception(sprintf('unhandled action: %s', $action));
             }
         }
     }
 }
开发者ID:philips,项目名称:ewiki,代码行数:31,代码来源:index.php

示例9: output

 /**
  * output
  * 
  * Output the image
  *
  * @param string $f (Optional) The filename to output to, if this is omitted the image is output to the browser
  * @return void
  * @access private
  * @author Dom Hastings
  */
 public function output($f = null, $options = array())
 {
     // merge in the options
     $options = array_merge_recursive_distinct(is_array($this->options['output']) ? $this->options['output'] : array(), is_array($options) ? $options : array());
     // if we're forcing an output type
     if (!empty($options['forceType'])) {
         $imageType = $options['forceType'];
     } else {
         $imageType = $this->info[2];
     }
     // use the correct output function
     switch ($imageType) {
         case IMAGETYPE_GIF:
             header('Content-type: ' . image_type_to_mime_type($imageType));
             imagegif($this->current, $f);
             break;
         case IMAGETYPE_JPEG:
         case IMAGETYPE_JPEG2000:
         case IMAGETYPE_JPC:
         case IMAGETYPE_JP2:
         case IMAGETYPE_JPX:
             header('Content-type: ' . image_type_to_mime_type($imageType));
             imagejpeg($this->current, $f, $options['jpeg']['quality']);
             break;
         case IMAGETYPE_PNG:
             header('Content-type: ' . image_type_to_mime_type($imageType));
             imagepng($this->current, $f, $options['png']['quality'], $options['png']['filters']);
             break;
         case IMAGETYPE_BMP:
         case IMAGETYPE_WBMP:
             header('Content-type: ' . image_type_to_mime_type($imageType));
             imagewbmp($this->current, $f);
             break;
         case IMAGETYPE_XBM:
             header('Content-type: ' . image_type_to_mime_type($imageType));
             imagexbm($this->current, $f);
             break;
         case IMAGETYPE_TIFF_II:
         case IMAGETYPE_TIFF_MM:
         case IMAGETYPE_IFF:
         case IMAGETYPE_JB2:
         case IMAGETYPE_SWF:
         case IMAGETYPE_PSD:
         case IMAGETYPE_SWC:
             // case IMAGETYPE_ICO:
         // case IMAGETYPE_ICO:
         default:
             break;
     }
 }
开发者ID:gomezjsus,项目名称:IAW,代码行数:60,代码来源:Image.class.php

示例10: imagejpeg

        imagejpeg($img, $imgname);
        break;
    case 'png':
        imagepng($img, $imgname);
        break;
    case 'bmp':
        imagebmp($img, $imgname);
        break;
    case 'gif':
        imagegif($img, $imgname);
        break;
    case 'vnd.wap.wbmp':
        imagewbmp($img, $imgname);
        break;
    case 'xbm':
        imagexbm($img, $imgname);
        break;
    default:
        imagejpeg($img, $imgname);
}
imagedestroy($img);
if ($fastemaal == "1") {
    /*$new_image = imagecreatetruecolor($ny_width, $ny_height);
        $aspect1 = $ny_height / $ny_width;
        $aspect1_o = $ny_width / $ny_height;
        $aspect2 = $after_croped_height / $after_croped_width;
    
        if ($aspect1 < $aspect2) {
            // lut i top og bund
            $start_y_f = round(($start_y/$full_height)*$height);
    
开发者ID:benjaco,项目名称:fileeater,代码行数:30,代码来源:customresize.php

示例11: thumbnail

 private function thumbnail($dir, $nome, $ext)
 {
     $new_width = 200;
     $new_height = $new_width;
     $diretorio = $dir . "/" . $nome;
     list($this->width, $this->height) = getimagesize($diretorio);
     switch ($this->type) {
         case 'image/jpeg':
             $img = imagecreatefromjpeg($diretorio);
             break;
         case 'image/jpg':
             $img = imagecreatefromjpeg($diretorio);
             break;
         case 'image/png':
             $img = imagecreatefrompng($diretorio);
             break;
         case 'image/bmp':
             $img = imagecreatefromwbmp($diretorio);
             break;
         case 'image/gif':
             $img = imagecreatefromgif($diretorio);
             break;
         default:
             # code...
             break;
     }
     //$img = imagecreatefrompng($diretorio);
     if ($this->width > $new_width) {
         $new_height = $new_width / $this->width * $this->height;
     }
     $thumb = imagecreatetruecolor($new_width, $new_height);
     imagecopyresampled($thumb, $img, 0, 0, 0, 0, $new_width, $new_height, $this->width, $this->height);
     switch ($this->type) {
         case 'image/jpeg':
             imagejpeg($thumb, "{$dir}/thumbnails/thumb_{$nome}");
             break;
         case 'image/jpg':
             imagejpeg($thumb, "{$dir}/thumbnails/thumb_{$nome}");
             break;
         case 'image/png':
             imagepng($thumb, "{$dir}/thumbnails/thumb_{$nome}");
             break;
         case 'image/bmp':
             imagexbm($thumb, "{$dir}/thumbnails/thumb_{$nome}");
             break;
         case 'image/gif':
             imagegif($thumb, "{$dir}/thumbnails/thumb_{$nome}");
             break;
         default:
             # code...
             break;
     }
 }
开发者ID:mozelli,项目名称:brcompras,代码行数:53,代码来源:ClassImagens.php

示例12: imageWater

 /**
  * -----------------------------
  * 给上传的图片添加水印
  * -----------------------------
  * @param  string $pic 要添加水印的图片
  * @param  string $waterPic 水印图片
  */
 private function imageWater($pic, $waterPic)
 {
     $picInfo = getimagesize($pic);
     $newPic = imagecreatetruecolor($picInfo[0], $picInfo[1]);
     //$white = imagecolorallocate($newPic,255,255,255);
     //imagefill($newPic,0,0,$white);
     switch ($picInfo[2]) {
         case 1:
             $spic = imagecreatefromgif($pic);
             break;
         case 2:
             $spic = imagecreatefromjpeg($pic);
             break;
         case 3:
             $spic = imagecreatefrompng($pic);
             break;
         case 15:
             $spic = imagecreatefromwbmp($pic);
             break;
         default:
             exit('不支持为此类型图片添加水印');
     }
     imagecopy($newPic, $spic, 0, 0, 0, 0, $picInfo[0], $picInfo[1]);
     imagedestroy($spic);
     $waterPicInfo = getimagesize($waterPic);
     switch ($waterPicInfo[2]) {
         case 1:
             $swaterPic = imagecreatefromgif($waterPic);
             break;
         case 2:
             $swaterPic = imagecreatefromjpeg($waterPic);
             break;
         case 3:
             $swaterPic = imagecreatefrompng($waterPic);
             break;
         case 15:
             $swaterPic = imagecreatefromwbmp($waterPic);
             break;
         default:
             exit('不支持此类型图片作为水印');
     }
     //将水印图片背景色设为透明色
     if ($this->waterPicBgcolor) {
         imagecolortransparent($swaterPic, $this->getColor($this->waterPicBgcolor, $swaterPic));
     }
     imagecopymerge($newPic, $swaterPic, $picInfo[0] - $waterPicInfo[0], $picInfo[1] - $waterPicInfo[1], 0, 0, $waterPicInfo[0], $waterPicInfo[1], $this->waterPct);
     imagedestroy($swaterPic);
     switch ($picInfo[2]) {
         case 1:
             imagegif($newPic, $pic);
             break;
         case 2:
             imagejpeg($newPic, $pic);
             break;
         case 3:
             imagepng($newPic, $pic);
             break;
         case 6:
             imagexbm($newPic, $pic);
             break;
     }
     imagedestroy($newPic);
 }
开发者ID:BGCX261,项目名称:zhwphp-svn-to-git,代码行数:70,代码来源:UpImage.class.php

示例13: _getImageFromRessource

 /**
  * Affiche l'image correspondant à la ressource dans le format souhaité
  *
  * @param ressource $im ressource de l'image
  * @param string $type type de l'image de sortie
  * @return bool
  */
 private static function _getImageFromRessource($im, $type)
 {
     if (($imgtype = self::_isSupportedImageType($type)) !== false) {
         header('Content-type:' . image_type_to_mime_type($imgtype) . ';');
         switch ($imgtype) {
             case IMG_GIF:
                 return imagegif($im);
                 break;
             case IMG_JPG:
             case IMG_JPEG:
                 return imagejpeg($im);
                 break;
             case IMG_PNG:
                 return imagepng($im);
                 break;
             case IMG_WBMP:
                 return imagewbmp($im);
                 break;
             case IMG_XPM:
                 return imagexbm($im);
                 break;
         }
     }
     header('Content-type:' . image_type_to_mime_type(IMG_PNG) . ';');
     return imagepng(self::_getErrorRessource('Le format "' . $type . '" n\'est pas supporté.'));
 }
开发者ID:keverage,项目名称:adminserv,代码行数:33,代码来源:tmnick.class.php

示例14: _types

 protected function _types()
 {
     $type = strtolower($this->type);
     if (!empty($this->save)) {
         $save = suffix($this->save, '.' . $type);
         $this->result['path'] = $save;
     } else {
         $save = NULL;
     }
     if ($type === 'jpeg') {
         if ($this->quality === 0) {
             $this->quality = 80;
         }
         imagejpeg($this->canvas, $save, $this->quality);
     } elseif ($type === 'png') {
         if ($this->quality === 0) {
             $this->quality = 8;
         }
         imagepng($this->canvas, $save, $this->quality);
     } elseif ($type === 'gif') {
         imagegif($this->canvas, $save);
     } elseif ($type === 'gd') {
         imagegd($this->canvas, $save);
     } elseif ($type === 'gd2') {
         imagegd2($this->canvas, $save, $this->quality);
     } elseif ($type === 'wbmp') {
         imagewbmp($this->canvas, $save, $this->quality);
     } elseif ($type === 'xbm') {
         imagexbm($this->canvas, $save, $this->quality);
     } elseif ($type === 'xpm') {
         imagexpm($this->canvas, $save, $this->quality);
     } elseif ($type === 'webp') {
         imagewebp($this->canvas, $save, $this->quality);
     }
     return $this;
 }
开发者ID:znframework,项目名称:znframework,代码行数:36,代码来源:InternalGD.php

示例15: saveImage

 /**
  * Prints the Image
  * 
  * @param string $name
  * @param string $directory
  * @param string $imageType
  */
 private function saveImage($name, $directory, $imageType = 'png', $foreground = null)
 {
     switch ($imageType) {
         case 'jpg':
         case 'jpeg':
             imagejpeg($this->imageProperties[0], $directory . DIRECTORY_SEPARATOR . $name . '.' . $imageType);
             break;
         case 'gif':
             imagegif($this->imageProperties[0], $directory . DIRECTORY_SEPARATOR . $name . '.' . $imageType);
             break;
         case 'gd':
             imagegd($this->imageProperties[0], $directory . DIRECTORY_SEPARATOR . $name . '.' . $imageType);
             break;
         case 'gd2':
             imagegd2($this->imageProperties[0], $directory . DIRECTORY_SEPARATOR . $name . '.' . $imageType);
             break;
         case 'webp':
             imagewebp($this->imageProperties[0], $directory . DIRECTORY_SEPARATOR . $name . '.' . $imageType);
             break;
         case 'wbmp':
             imagewbmp($this->imageProperties[0], $directory . DIRECTORY_SEPARATOR . $name . '.' . $imageType, $foreground);
             break;
         case 'xbm':
             imagexbm($this->imageProperties[0], $directory . DIRECTORY_SEPARATOR . $name . '.' . $imageType, $foreground);
             break;
         case 'svg':
         default:
             imagepng($this->imageProperties[0], $directory . DIRECTORY_SEPARATOR . $name . '.' . $imageType);
     }
     imagedestroy($this->imageProperties[0]);
 }
开发者ID:rajibmp,项目名称:imager,代码行数:38,代码来源:DrawImage.php


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