• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP imagewbmp函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getImage

 /**
  * Get the image in a specific format
  * @param  string|null $format        optional format to get the image in, if null the source image format is used
  * @return string binary string of the converted image
  */
 public function getImage(string $format = null) : string
 {
     if (!$format) {
         $format = explode('/', $this->info['mime'], 2)[1];
     }
     switch (strtolower($format)) {
         case 'jpg':
         case 'jpeg':
             ob_start();
             imagejpeg($this->data);
             return ob_get_clean();
         case 'bitmap':
         case 'bmp':
             ob_start();
             imagewbmp($this->data);
             return ob_get_clean();
         case 'png':
             ob_start();
             imagepng($this->data);
             return ob_get_clean();
         case 'gif':
             ob_start();
             imagegif($this->data);
             return ob_get_clean();
         case 'webp':
             ob_start();
             imagewebp($this->data, null);
             return ob_get_clean();
         default:
             throw new ImageException('Unsupported format');
     }
 }
开发者ID:vakata,项目名称:image,代码行数:37,代码来源:GD.php


示例2: display

 function display()
 {
     ob_end_flush();
     ob_start();
     switch (strtolower($this->format)) {
         case 'jpeg':
         case 'jpg':
             imagejpeg($this->data);
             break;
         case 'gif':
             imagegif($this->data);
             break;
         case 'png':
             imagepng($this->data);
             break;
         case 'wbmp':
             imagewbmp($this->data);
             break;
         default:
             ob_end_clean();
             return NULL;
     }
     $image = ob_get_contents();
     ob_end_clean();
     return $image;
 }
开发者ID:Kraiany,项目名称:kraiany_site_docker,代码行数:26,代码来源:gd.php


示例3: genFile

 public function genFile($fileName, $quality = 100)
 {
     $image = parent::returnThumbnail();
     $result = false;
     if (!empty($image)) {
         switch ($this->image_type) {
             case 1:
                 $result = imagegif($image, $fileName);
                 break;
             case 2:
                 $quality = (int) $quality;
                 if ($quality < 0 || $quality > 100) {
                     $quality = 75;
                 }
                 // end if
                 $result = imagejpeg($image, $fileName, $quality);
                 break;
             case 3:
                 $result = imagepng($image, $fileName);
                 break;
             case 15:
                 $result = imagewbmp($image, $fileName);
                 break;
         }
         // end switch
     }
     return $result;
 }
开发者ID:hetao29,项目名称:slightphp,代码行数:28,代码来源:SThumbnail.php


示例4: index

 public function index($image_id)
 {
     $result = mysqli_fetch_array($this->db->db_query("SELECT `Image` FROM `Restaurant_Images` where `idRestaurant_Images` = '{$image_id}'"));
     $uri = 'data://application/octet-stream;base64,' . base64_encode($result['Image']);
     $image_type = getimagesize($uri);
     if ($result !== NULL) {
         header('Content-Type: ', $image_type['mime']);
         $image = imagecreatefromstring($result['Image']);
         switch ($image_type['mime']) {
             case 'image/jpeg':
                 imagejpeg($image);
                 break;
             case 'image/bmp':
                 imagewbmp($image);
                 break;
             case 'image/gif':
                 imagegif($image);
                 break;
             case 'image/png':
                 imagepng($image);
                 break;
             default:
                 echo "Unsupported picture type: " . $image_type;
                 return;
         }
         imagedestroy($image);
     } else {
         header('Content-Type: image/png');
         $fp = fopen(APP_ROOT . '/img/restaurant.png', 'r');
         fpassthru($fp);
     }
 }
开发者ID:swatisaoji1,项目名称:tableforyou,代码行数:32,代码来源:image.php


示例5: createImageFile

 /**
  * @brief 生成图片文件
  * @param resource $imageRes      图片资源名称
  * @param string   $thumbFileName 缩略图名称
  * @param bool     $imageResult   生成缩略图状态 true:成功; false:失败;
  */
 public static function createImageFile($imageRes, $thumbFileName)
 {
     //如果目录不可写直接返回,防止错误抛出
     if (!is_writeable(dirname($thumbFileName))) {
         return false;
     }
     $imageResult = false;
     //获取文件扩展名
     $fileExt = IFile::getFileSuffix($thumbFileName);
     switch ($fileExt) {
         case 'jpg':
         case 'jpeg':
             $imageResult = imagejpeg($imageRes, $thumbFileName, 100);
             break;
         case 'gif':
             $imageResult = imagegif($imageRes, $thumbFileName);
             break;
         case 'png':
             $imageResult = imagepng($imageRes, $thumbFileName);
             break;
         case 'bmp':
             $imageResult = imagewbmp($imageRes, $thumbFileName);
             break;
     }
     return $imageResult;
 }
开发者ID:chenyongze,项目名称:iwebshop,代码行数:32,代码来源:image_class.php


示例6: resize

function resize($filename, $size, $quality)
{
    $dir = UPLOADDIR;
    // Адрес директории для сохранения картинки
    $ext = strtolower(strrchr(basename($filename), "."));
    // Получаем формат уменьшаемого изображения
    $extentions = array('.jpg', '.gif', '.png', '.bmp');
    // Определяем формат уменьшаемой картинки
    if (in_array($ext, $extentions)) {
        echo '01';
        $percent = $size;
        // Ширина изображения миниатюры
        list($width, $height) = getimagesize(UPLOADDIR . $filename);
        // Возвращает ширину и высоту картинки
        $newheight = $height * $percent;
        $newwidth = $newheight / $width;
        $thumb = imagecreatetruecolor($percent, $newwidth);
        switch ($ext) {
            case '.jpg':
                $source = @imagecreatefromjpeg(UPLOADDIR . $filename);
                break;
            case '.gif':
                $source = @imagecreatefromgif(UPLOADDIR . $filename);
                break;
            case '.png':
                $source = @imagecreatefrompng(UPLOADDIR . $filename);
                break;
            case '.bmp':
                $source = @imagecreatefromwbmp(UPLOADDIR . $filename);
                break;
        }
        // php уменьшение изображения
        imagecopyresized($thumb, $source, 0, 0, 0, 0, $percent, $newwidth, $width, $height);
        // Создаем изображение
        switch ($ext) {
            case '.jpg':
                imagejpeg($thumb, UPLOADDIR . "min_" . $filename, $quality);
                // Для JPEG картинок
                break;
            case '.gif':
                imagegif($thumb, UPLOADDIR . $filename);
                // Для GIF картинки
                break;
            case '.png':
                imagepng($thumb, UPLOADDIR . $filename, $quality);
                // Для PNG картинок
                break;
            case '.bmp':
                imagewbmp($thumb, UPLOADDIR . $filename);
                // Для BMP картинки
                break;
        }
    } else {
        return 'typeError';
    }
    @imagedestroy($thumb);
    @imagedestroy($source);
    return $filename;
}
开发者ID:alim-abdurakhmanov,项目名称:001,代码行数:59,代码来源:imgresolution.php


示例7: make_thumb

/**
 * Make a thumbnail of a newly uploaded file if it is an image
 *
 * @param $src the source of the file
 * @param $dest where to save the thumbnail
 * @param $fileExt the file extension (to check if the file is an image)
 * @param $desired_width the desired width of the thumbnail, height and width are kept in ratio
 */
function make_thumb($src, $dest, $fileExt, $desired_width)
{
    $exif = exif_read_data($src, 'IFD0');
    // Read the source image
    if ($fileExt == 'gif') {
        $source_image = imagecreatefromgif($src);
    } elseif ($fileExt == 'jpg' || $fileExt == 'jpeg') {
        $source_image = imagecreatefromjpeg($src);
    } elseif ($fileExt == 'png') {
        $source_image = imagecreatefrompng($src);
    } elseif ($fileExt == 'wbmp') {
        $source_image = imagecreatefromwbmp($src);
    } else {
        // Return if not an image
        return;
    }
    // Fix Orientation of original image - this has to be done because of stupid apple products who can't save their
    // orientation like everybody else, ugh!
    switch ($exif['Orientation']) {
        case 3:
            $source_image = imagerotate($source_image, 180, 0);
            break;
        case 6:
            $source_image = imagerotate($source_image, -90, 0);
            break;
        case 8:
            $source_image = imagerotate($source_image, 90, 0);
            break;
    }
    // Save turned source image again (overwrites false orientation)
    if ($fileExt == 'gif') {
        imagegif($source_image, $src);
    } elseif ($fileExt == 'jpg' || $fileExt == 'jpeg') {
        imagejpeg($source_image, $src);
    } elseif ($fileExt == 'png') {
        imagepng($source_image, $src);
    } elseif ($fileExt == 'bmp') {
        imagewbmp($source_image, $src);
    }
    $width = imagesx($source_image);
    $height = imagesy($source_image);
    // Find the "desired height" of this thumbnail, relative to the desired width
    $desired_height = floor($height * ($desired_width / $width));
    // Create a new, "virtual" image
    $virtual_image = imagecreatetruecolor($desired_width, $desired_height);
    // Copy source image at a resized size
    imagecopyresampled($virtual_image, $source_image, 0, 0, 0, 0, $desired_width, $desired_height, $width, $height);
    // Create the physical thumbnail image to its destination
    if ($fileExt == 'gif') {
        imagegif($virtual_image, $dest);
    } elseif ($fileExt == 'jpg' || $fileExt == 'jpeg') {
        imagejpeg($virtual_image, $dest);
    } elseif ($fileExt == 'png') {
        imagepng($virtual_image, $dest);
    } elseif ($fileExt == 'bmp') {
        imagewbmp($virtual_image, $dest);
    }
}
开发者ID:jundl77,项目名称:FamShare,代码行数:66,代码来源:utility.php


示例8: create

 public function create()
 {
     //набор символов
     $letters = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'q', 'j', 'k', 'm', 'n', 'p', 'z', 'x', 'y', 's', 'u', 't', '2', '4', '5', '6', '7', '8', '9', '%', '+', '@', '#', '=', '?');
     //цвета
     $colors = array('90', '110', '130', '150', '170', '190', '210');
     $src = imagecreatetruecolor($this->width, $this->height);
     //создаем изображение
     $fon = imagecolorallocate($src, 255, 255, 255);
     //создаем фон
     imagefill($src, 0, 0, $fon);
     //заливаем изображение фоном
     for ($i = 0; $i < $this->fon_let_amount; $i++) {
         //случайный цвет
         $color = imagecolorallocatealpha($src, rand(0, 255), rand(0, 255), rand(0, 255), 100);
         //случайный символ
         $letter = $letters[rand(0, sizeof($letters) - 1)];
         //случайный размер
         $size = rand($this->font_size - 2, $this->font_size + 2);
         imagettftext($src, $size, rand(0, 45), rand($this->width * 0.1, $this->width - $this->width * 0.1), rand($this->height * 0.2, $this->height), $color, $this->font, $letter);
     }
     $code = array();
     for ($i = 0; $i < $this->let_amount; $i++) {
         $color = imagecolorallocatealpha($src, $colors[rand(0, sizeof($colors) - 1)], $colors[rand(0, sizeof($colors) - 1)], $colors[rand(0, sizeof($colors) - 1)], rand(20, 40));
         $letter = $letters[rand(0, sizeof($letters) - 1)];
         $size = rand($this->font_size * 2 - 2, $this->font_size * 2 + 2);
         $x = ($i + 1) * $this->font_size + rand(1, 5);
         //даем каждому символу случайное смещение
         $y = $this->height * 2 / 3 + rand(0, 5);
         $code[] = $letter;
         //запоминаем код
         imagettftext($src, $size, rand(0, 15), $x, $y, $color, $this->font, $letter);
     }
     $code = implode('', $code);
     //переводим код в строку
     // Обработка вывода
     if (imagetypes() & IMG_JPG) {
         // для JPEG
         header('Content-Type: image/jpeg');
         imagejpeg($src, NULL, 100);
     } elseif (imagetypes() & IMG_PNG) {
         // для PNG
         header('Content-Type: image/png');
         imagepng($src);
     } elseif (imagetypes() & IMG_GIF) {
         // для GIF
         header('Content-Type: image/gif');
         imagegif($src);
     } elseif (imagetypes() & IMG_PNG) {
         // для WBMP
         header('Content-Type: image/vnd.wap.wbmp');
         imagewbmp($src);
     } else {
         imagedestroy($src);
         return;
     }
     Session::set_server_data(array('captcha' => $code));
 }
开发者ID:viking2000,项目名称:web-antarix,代码行数:58,代码来源:captcha.php


示例9: build

 public function build($text = '', $showText = true, $fileName = null)
 {
     if (trim($text) <= ' ') {
         throw new exception('barCode::build - must be passed text to operate');
     }
     if (!($fileType = $this->outMode[$this->mode])) {
         throw new exception("barCode::build - unrecognized output format ({$this->mode})");
     }
     if (!function_exists("image{$this->mode}")) {
         throw new exception("barCode::build - unsupported output format ({$this->mode} - check phpinfo)");
     }
     $text = strtoupper($text);
     $dispText = "* {$text} *";
     $text = "*{$text}*";
     // adds start and stop chars
     $textLen = strlen($text);
     $barcodeWidth = $textLen * (7 * $this->bcThinWidth + 3 * $this->bcThickWidth) - $this->bcThinWidth;
     $im = imagecreate($barcodeWidth, $this->bcHeight);
     $black = imagecolorallocate($im, 0, 0, 0);
     $white = imagecolorallocate($im, 255, 255, 255);
     imagefill($im, 0, 0, $white);
     $xpos = 0;
     for ($idx = 0; $idx < $textLen; $idx++) {
         if (!($char = $text[$idx])) {
             $char = '-';
         }
         for ($ptr = 0; $ptr <= 8; $ptr++) {
             $elementWidth = $this->codeMap[$char][$ptr] ? $this->bcThickWidth : $this->bcThinWidth;
             if (($ptr + 1) % 2) {
                 imagefilledrectangle($im, $xpos, 0, $xpos + $elementWidth - 1, $this->bcHeight, $black);
             }
             $xpos += $elementWidth;
         }
         $xpos += $this->bcThinWidth;
     }
     if ($showText) {
         $pxWid = imagefontwidth($this->fontSize) * strlen($dispText) + 10;
         $pxHt = imagefontheight($this->fontSize) + 2;
         $bigCenter = $barcodeWidth / 2;
         $textCenter = $pxWid / 2;
         imagefilledrectangle($im, $bigCenter - $textCenter, $this->bcHeight - $pxHt, $bigCenter + $textCenter, $this->bcHeight, $white);
         imagestring($im, $this->fontSize, $bigCenter - $textCenter + 5, $this->bcHeight - $pxHt + 1, $dispText, $black);
     }
     if (!$fileName) {
         header("Content-type:  image/{$fileType}");
     }
     switch ($this->mode) {
         case 'gif':
             imagegif($im, $fileName);
         case 'png':
             imagepng($im, $fileName);
         case 'jpeg':
             imagejpeg($im, $fileName);
         case 'wbmp':
             imagewbmp($im, $fileName);
     }
     imagedestroy($im);
 }
开发者ID:arvinnizar,项目名称:elibrary,代码行数:58,代码来源:Barcode.php


示例10: generate

 /**
  * {@inheritdoc}
  */
 public function generate($output, $outputPath = null)
 {
     // WBMP foreground seem doesn't work...
     if (!is_null($this->foreground)) {
         imagewbmp($output, $outputPath, $this->foreground->getColor());
     } else {
         imagewbmp($output, $outputPath);
     }
 }
开发者ID:moust,项目名称:paint,代码行数:12,代码来源:WBMP.php


示例11: cropAction

 public function cropAction(Request $request)
 {
     $imageId = $request->request->get('imageId');
     /* @var $galleryImage GalleryImage */
     $galleryImage = $this->getDoctrine()->getRepository('KarolineKroissGalleryBundle:GalleryImage')->findOneBy(['id' => $imageId]);
     $targetWidth = 65;
     $targetHeight = 65;
     $quality = 100;
     $src = $galleryImage->getAbsolutePath();
     $src = $galleryImage->getUploadRootDir() . '/../../' . $galleryImage->getPreviewPath();
     $dst = $galleryImage->getUploadRootDir() . '/../../' . $galleryImage->getThumbnailPath();
     $type = strtolower(substr(strrchr($src, '.'), 1));
     if ($type == 'jpeg') {
         $type = 'jpg';
     }
     switch ($type) {
         case 'bmp':
             $imageResource = imagecreatefromwbmp($src);
             break;
         case 'gif':
             $imageResource = imagecreatefromgif($src);
             break;
         case 'jpg':
             $imageResource = imagecreatefromjpeg($src);
             break;
         case 'png':
             $imageResource = imagecreatefrompng($src);
             break;
         default:
             return 'Unsupported picture type!';
     }
     $destinationResource = imagecreatetruecolor($targetWidth, $targetHeight);
     imagecopyresampled($destinationResource, $imageResource, 0, 0, $request->request->get('x'), $request->request->get('y'), $targetWidth, $targetHeight, $request->request->get('w'), $request->request->get('h'));
     // preserve transparency
     if ($type == 'gif' or $type == 'png') {
         imagecolortransparent($destinationResource, imagecolorallocatealpha($destinationResource, 0, 0, 0, 127));
         imagealphablending($destinationResource, false);
         imagesavealpha($destinationResource, true);
     }
     switch ($type) {
         case 'bmp':
             imagewbmp($destinationResource, $dst);
             break;
         case 'gif':
             imagegif($destinationResource, $dst);
             break;
         case 'jpg':
             imagejpeg($destinationResource, $dst);
             break;
         case 'png':
             imagepng($destinationResource, $dst);
             break;
     }
     $request->headers->get('referer');
     return new RedirectResponse($request->headers->get('referer'));
 }
开发者ID:stereomon,项目名称:karo,代码行数:56,代码来源:GalleryImageCrudController.php


示例12: wbmp_to_zpl

/**
 * Converts image file contents to ZPL "download graphic" command
 *
 * @param string $in image binary string
 *
 * @param string $name arbitrary filename
 *
 * @return string ZPL "download graphic" command
 */
function wbmp_to_zpl($in, $name = '')
{
    if (empty($in)) {
        return '';
    }
    // Load image
    $im = imagecreatefromstring($in);
    if ($im === false) {
        return false;
    }
    // Black and white only
    imagefilter($im, IMG_FILTER_GRAYSCALE);
    //first, convert to grayscale
    imagefilter($im, IMG_FILTER_CONTRAST, -255);
    //then, apply a full contrast
    // Convert to WBMP
    ob_start();
    imagewbmp($im);
    $wbmp = ob_get_contents();
    ob_end_clean();
    $type = uintvar_shift($wbmp);
    $fixed = uintvar_shift($wbmp);
    $w = uintvar_shift($wbmp);
    $h = uintvar_shift($wbmp);
    $bitmap = ~$wbmp;
    // Black is white, white is black
    $total_bytes = strlen($bitmap);
    $bytes_per_line = ceil($w / 8);
    if ($w % 8 > 0) {
        // End of line is padded with black; make that white
        // Get last byte of each line
        $period = ceil($w / 8);
        for ($i = $bytes_per_line; $i <= $total_bytes; $i += $bytes_per_line) {
            $byte = ord($bitmap[$i - 1]);
            for ($j = 1; $j <= $w % 8; $j++) {
                // Flip j-th bit
                $byte = $byte & ~(1 << $j - 1);
            }
            $bitmap[$i - 1] = chr($byte);
        }
    }
    $uncompressed = strtoupper(bin2hex($bitmap));
    $compressed = preg_replace_callback('/(.)\\1{2,399}/', "zpl_rle_compress_helper", $uncompressed);
    $name = preg_replace('/[^A-z0-9]/', '', $name);
    if (strlen($name) > 8) {
        $name = substr($name, 0, 8);
    }
    $name = strtoupper($name);
    if (empty($name)) {
        $name = rand(10000000, 99999999);
    }
    $r = "~DG" . $name . ".GRF," . $total_bytes . "," . $bytes_per_line . "," . $compressed;
    return $r;
}
开发者ID:pbosakov,项目名称:image2zpl,代码行数:63,代码来源:image2zpl.inc.php


示例13: resizeImage

 function resizeImage($image, $width, $height, $scale)
 {
     $newImageWidth = ceil($width * $scale);
     $newImageHeight = ceil($height * $scale);
     $newImage = imagecreatetruecolor($newImageWidth, $newImageHeight);
     $ext = strtolower(substr(basename($image), strrpos(basename($image), ".") + 1));
     $source = "";
     if ($ext == 'jpeg') {
         $ext = 'jpg';
     }
     switch ($ext) {
         case 'bmp':
             $source = imagecreatefromwbmp($image);
             break;
         case 'gif':
             $source = imagecreatefromgif($image);
             break;
         case 'jpg':
             $source = imagecreatefromjpeg($image);
             break;
         case 'png':
             $source = imagecreatefrompng($image);
             break;
     }
     // preserve transparency
     if ($ext == "gif" or $ext == "png") {
         imagecolortransparent($source, imagecolorallocatealpha($source, 0, 0, 0, 127));
         imagealphablending($newImage, false);
         imagesavealpha($newImage, true);
     }
     imagecopyresampled($newImage, $source, 0, 0, 0, 0, $newImageWidth, $newImageHeight, $width, $height);
     imageinterlace($newImage, true);
     switch ($ext) {
         case 'bmp':
             imagewbmp($newImage, $image);
             break;
         case 'gif':
             imagegif($newImage, $image);
             break;
         case 'jpg':
             imagejpeg($newImage, $image, 100);
             break;
         case 'png':
             imagepng($newImage, $image, 0);
             break;
     }
     chmod($image, 0777);
     return $image;
 }
开发者ID:beyondkeysystem,项目名称:testone,代码行数:49,代码来源:JobportalImageComponent.php


示例14: save

 /**
  * 将图片资源保存到文件
  *
  * @param string $output      输出文件路径
  * @param string $outputType  输出类型, 默认为原图片类型
  * @return bool
  * @throws Exception
  */
 public function save($output, $outputType = '')
 {
     $outputType or $outputType = $this->mime;
     switch ($outputType) {
         case 'image/gif':
             return imagegif($this->resource, $output);
         case 'image/jpeg':
             return imagejpeg($this->resource, $output);
         case 'image/png':
             return imagepng($this->resource, $output);
         case 'image/bmp':
             return imagewbmp($this->resource, $output);
         default:
             throw new Exception("{$this->mime} type does not be image helper support");
     }
 }
开发者ID:sujinw,项目名称:passport,代码行数:24,代码来源:Image.php


示例15: ShowKey

function ShowKey()
{
    $key = strtolower(domake_password(4));
    $set = esetcookie("checkkey", $key);
    //是否支持gd库
    if (function_exists("imagejpeg")) {
        header("Content-type: image/jpeg");
        $img = imagecreate(69, 20);
        $black = imagecolorallocate($img, 255, 255, 255);
        $gray = imagecolorallocate($img, 102, 102, 102);
        imagefill($img, 0, 0, $gray);
        imagestring($img, 3, 14, 3, $key, $black);
        imagejpeg($img);
        imagedestroy($img);
    } elseif (function_exists("imagegif")) {
        header("Content-type: image/gif");
        $img = imagecreate(69, 20);
        $black = imagecolorallocate($img, 255, 255, 255);
        $gray = imagecolorallocate($img, 102, 102, 102);
        imagefill($img, 0, 0, $gray);
        imagestring($img, 3, 14, 3, $key, $black);
        imagegif($img);
        imagedestroy($img);
    } elseif (function_exists("imagepng")) {
        header("Content-type: image/png");
        $img = imagecreate(69, 20);
        $black = imagecolorallocate($img, 255, 255, 255);
        $gray = imagecolorallocate($img, 102, 102, 102);
        imagefill($img, 0, 0, $gray);
        imagestring($img, 3, 14, 3, $key, $black);
        imagepng($img);
        imagedestroy($img);
    } elseif (function_exists("imagewbmp")) {
        header("Content-type: image/vnd.wap.wbmp");
        $img = imagecreate(69, 20);
        $black = imagecolorallocate($img, 255, 255, 255);
        $gray = imagecolorallocate($img, 102, 102, 102);
        imagefill($img, 0, 0, $gray);
        imagestring($img, 3, 14, 3, $key, $black);
        imagewbmp($img);
        imagedestroy($img);
    } else {
        $set = esetcookie("checkkey", "ebak");
        @(include "class/functions.php");
        echo ReadFiletext("images/ebak.jpg");
    }
}
开发者ID:ailingsen,项目名称:pigcms,代码行数:47,代码来源:ShowKey.php


示例16: thumbnail

function thumbnail($inputFileName, $outputFileName, $maxSize = 100)
{
    $info = getimagesize($inputFileName);
    $type = isset($info['type']) ? $info['type'] : $info[2];
    if (!(imagetypes() & $type)) {
        return false;
    }
    $width = isset($info['width']) ? $info['width'] : $info[0];
    $height = isset($info['height']) ? $info['height'] : $info[1];
    $wRatio = $maxSize / $width;
    $hRatio = $maxSize / $height;
    $sourceImage = imagecreatefromstring(file_get_contents($inputFileName));
    if ($width <= $maxSize && $height <= $maxSize) {
        return $sourceImage;
    } elseif ($wRatio * $height < $maxSize) {
        $tHeight = ceil($wRatio * $height);
        $tWidth = $maxSize;
    } else {
        $tWidth = ceil($hRatio * $width);
        $tHeight = $maxSize;
    }
    $thumb = imagecreatetruecolor($tWidth, $tHeight);
    if ($sourceImage === false) {
        return false;
    }
    imagecopyresampled($thumb, $sourceImage, 0, 0, 0, 0, $tWidth, $tHeight, $width, $height);
    imagedestroy($sourceImage);
    $ext = strtolower(substr($outputFileName, strrpos($outputFileName, '.')));
    switch ($ext) {
        case '.gif':
            imagegif($thumb, $outputFileName);
            break;
        case '.jpg':
        case '.jpeg':
            imagejpeg($thumb, $outputFileName, 80);
            break;
        case '.png':
            imagepng($thumb, $outputFileName);
            break;
        case '.bmp':
            imagewbmp($thumb, $outputFileName);
            break;
        default:
            return false;
    }
    return true;
}
开发者ID:krewenki,项目名称:ojo,代码行数:47,代码来源:index.php


示例17: save

 public function save($file, $quality = 90)
 {
     $info = pathinfo($file);
     $extension = strtolower($info['extension']);
     if (is_resource($this->image)) {
         if ($extension == 'jpeg' || $extension == 'jpg' || $extension == 'JPG') {
             imagejpeg($this->image, $file, $quality);
         } elseif ($extension == 'png') {
             imagepng($this->image, $file);
         } elseif ($extension == 'gif') {
             imagegif($this->image, $file);
         } elseif ($extension == 'bmp' || $extension == 'BMP') {
             imagewbmp($this->image, $file);
         }
         imagedestroy($this->image);
     }
 }
开发者ID:hutdast,项目名称:rip,代码行数:17,代码来源:image.php


示例18: saveFile

 public function saveFile($filename)
 {
     switch ($this->type) {
         case 'jpg':
         case 'jpeg':
             imagejpeg($this->resource, $filename);
             break;
         case 'gif':
             imagegif($this->resource, $filename);
             break;
         case 'png':
             imagepng($this->resource, $filename);
             break;
         case 'bmp':
             imagewbmp($this->resource, $filename);
             break;
     }
 }
开发者ID:quintenvk,项目名称:quintenvk,代码行数:18,代码来源:Image.php


示例19: printimg

 private function printimg()
 {
     if (function_exists("imagegif")) {
         header("Content-Type:images/gif");
         imagegif($this->img);
     } elseif (function_exists("imagejpeg")) {
         header("Content-Type:images/jpeg");
         imagejpeg($this->img);
     } elseif (function_exists("imagepng")) {
         header("Content-Type:images/png");
         imagepng($this->img);
     } elseif (function_exists("imagewbmp")) {
         header("Content-Type:images/vnd.wap.wbmp");
         imagewbmp($this->img);
     } else {
         die("No image support in this PHP server");
     }
 }
开发者ID:elaine96,项目名称:message,代码行数:18,代码来源:vcode.class.php


示例20: display

 function display($im)
 {
     if (function_exists("imagepng")) {
         header("Content-type: image/png");
         imagepng($im);
     } elseif (function_exists("imagegif")) {
         header("Content-type: image/gif");
         imagegif($im);
     } elseif (function_exists("imagejpeg")) {
         header("Content-type: image/jpeg");
         imagejpeg($im, "", 0.5);
     } elseif (function_exists("imagewbmp")) {
         header("Content-type: image/vnd.wap.wbmp");
         imagewbmp($im);
     } else {
         return false;
     }
     return true;
 }
开发者ID:CDESmith,项目名称:newtwo,代码行数:19,代码来源:gradientfill.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP imagexbm函数代码示例发布时间:2022-05-15
下一篇:
PHP imagetypes函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap