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

PHP imagefill函数代码示例

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

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



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

示例1: load

 static function load($filename)
 {
     $info = getimagesize($filename);
     list($width, $height) = $info;
     if (!$width || !$height) {
         return null;
     }
     $image = null;
     switch ($info['mime']) {
         case 'image/gif':
             $image = imagecreatefromgif($filename);
             break;
         case 'image/jpeg':
             $image = imagecreatefromjpeg($filename);
             break;
         case 'image/png':
             $image = imagecreatetruecolor($width, $height);
             $white = imagecolorallocate($image, 255, 255, 255);
             imagefill($image, 0, 0, $white);
             $png = imagecreatefrompng($filename);
             imagealphablending($png, true);
             imagesavealpha($png, true);
             imagecopy($image, $png, 0, 0, 0, 0, $width, $height);
             imagedestroy($png);
             break;
     }
     if ($image) {
         return new image($image, $width, $height);
     } else {
         return null;
     }
 }
开发者ID:nyan-cat,项目名称:easyweb,代码行数:32,代码来源:image.php


示例2: render

 /**
  * @return ZipInterface
  */
 public function render()
 {
     $pathThumbnail = $this->getPresentation()->getPresentationProperties()->getThumbnailPath();
     if ($pathThumbnail) {
         // Size : 128x128 pixel
         // PNG : 8bit, non-interlaced with full alpha transparency
         $gdImage = imagecreatefromstring(file_get_contents($pathThumbnail));
         if ($gdImage) {
             list($width, $height) = getimagesize($pathThumbnail);
             $gdRender = imagecreatetruecolor(128, 128);
             $colorBgAlpha = imagecolorallocatealpha($gdRender, 0, 0, 0, 127);
             imagecolortransparent($gdRender, $colorBgAlpha);
             imagefill($gdRender, 0, 0, $colorBgAlpha);
             imagecopyresampled($gdRender, $gdImage, 0, 0, 0, 0, 128, 128, $width, $height);
             imagetruecolortopalette($gdRender, false, 255);
             imagesavealpha($gdRender, true);
             ob_start();
             imagepng($gdRender);
             $imageContents = ob_get_contents();
             ob_end_clean();
             imagedestroy($gdRender);
             imagedestroy($gdImage);
             $this->getZip()->addFromString('Thumbnails/thumbnail.png', $imageContents);
         }
     }
     return $this->getZip();
 }
开发者ID:phpoffice,项目名称:phppowerpoint,代码行数:30,代码来源:ThumbnailsThumbnail.php


示例3: save

 public function save()
 {
     $maxHeight = 0;
     $width = 0;
     foreach ($this->_segmentsArray as $segment) {
         $maxHeight = max($maxHeight, $segment->height);
         $width += $segment->width;
     }
     // create our canvas
     $img = imagecreatetruecolor($width, $maxHeight);
     $background = imagecolorallocatealpha($img, 255, 255, 255, 127);
     imagefill($img, 0, 0, $background);
     imagealphablending($img, false);
     imagesavealpha($img, true);
     // start placing our images on a single x axis
     $xPos = 0;
     foreach ($this->_segmentsArray as $segment) {
         $tmp = imagecreatefromjpeg($segment->pathToImage);
         imagecopy($img, $tmp, $xPos, 0, 0, 0, $segment->width, $segment->height);
         $xPos += $segment->width;
         imagedestroy($tmp);
     }
     // create our final output image.
     imagepng($img, $this->_saveToPath);
 }
开发者ID:ejacobs,项目名称:css-sprite,代码行数:25,代码来源:CssSprite.php


示例4: embroidery2image

function embroidery2image($embroidery, $scale_post = 1, $scale_pre = false)
{
    // Create image
    $im = imagecreatetruecolor(ceil($embroidery->imageWidth * $scale_post), ceil($embroidery->imageHeight * $scale_post));
    imagesavealpha($im, true);
    imagealphablending($im, false);
    $color = imagecolorallocatealpha($im, 255, 255, 255, 127);
    imagefill($im, 0, 0, $color);
    // Draw stitches
    foreach ($embroidery->blocks as $block) {
        $color = imagecolorallocate($im, $block->color->r, $block->color->g, $block->color->b);
        $x = false;
        foreach ($block->stitches as $stitch) {
            if ($x !== false) {
                imageline($im, ($x - $embroidery->min->x) * $scale_post, ($y - $embroidery->min->y) * $scale_post, ($stitch->x - $embroidery->min->x) * $scale_post, ($stitch->y - $embroidery->min->y) * $scale_post, $color);
            }
            $x = $stitch->x;
            $y = $stitch->y;
        }
    }
    // Scale finished image
    if ($scale_pre) {
        $im2 = imagecreatetruecolor($embroidery->imageWidth * $scale_post * $scale_pre, $embroidery->imageHeight * $scale_post * $scale_pre);
        imagesavealpha($im2, true);
        imagealphablending($im2, false);
        imagecopyresized($im2, $im, 0, 0, 0, 0, $embroidery->imageWidth * $scale_post * $scale_pre, $embroidery->imageHeight * $scale_post * $scale_pre, $embroidery->imageWidth * $scale_post, $embroidery->imageHeight * $scale_post);
        imagedestroy($im);
        $im = $im2;
    }
    return $im;
}
开发者ID:bobosch,项目名称:embroidery,代码行数:31,代码来源:embroidery2image.php


示例5: draw

 /**
  * 2015-12-08
  * Точка отсчёта системы координат [0, 0] — это самая левая верхняя точка холста.
  * Далее кординаты увеличиваются вниз и вправо.
  * @override
  * @see \Df\GoogleFont\Fonts\Png::draw()
  * @used-by \Df\GoogleFont\Fonts\Png::image()
  * @param resource $image
  * @return void
  */
 protected function draw($image)
 {
     $r = imagefill($image, 0, 0, $this->colorAllocateAlpha($image, $this->bgColor()));
     df_assert($r);
     $r = imagettftext($image, $this->fontSize(), 0, $this->marginLeft(), $this->height() - abs($this->contentBottomY()), $this->colorAllocateAlpha($image, $this->fontColor()), $this->ttfPath(), $this->text());
     df_assert($r);
 }
开发者ID:mage2pro,项目名称:google-font,代码行数:17,代码来源:Preview.php


示例6: codeimage

 static function codeimage()
 {
     $image = imagecreatetruecolor(100, 30);
     $bgcolor = imagecolorallocate($image, 255, 255, 255);
     imagefill($image, 0, 0, $bgcolor);
     $code = '';
     for ($i = 0; $i < 4; $i++) {
         $fontsize = 6;
         $fontcolor = imagecolorallocate($image, rand(0, 120), rand(0, 120), rand(0, 120));
         $data = "abcdefghjkmnpqrstuvwxy3456789";
         $fontcontent = substr($data, rand(1, strlen($data) - 1), 1);
         $code .= $fontcontent;
         $x = $i * 100 / 4 + rand(5, 10);
         $y = rand(5, 10);
         imagestring($image, $fontsize, $x, $y, $fontcontent, $fontcolor);
     }
     for ($i = 0; $i < 200; $i++) {
         $pointcolor = imagecolorallocate($image, rand(50, 200), rand(50, 200), rand(50, 200));
         imagesetpixel($image, rand(1, 99), rand(1, 29), $pointcolor);
     }
     for ($i = 0; $i < 2; $i++) {
         $linecolor = imagecolorallocate($image, rand(80, 220), rand(80, 220), rand(80, 220));
         imageline($image, rand(1, 99), rand(1, 29), rand(1, 99), rand(1, 29), $linecolor);
     }
     $return['code'] = $code;
     $return['image'] = $image;
     return $return;
     //		header('content-type:image/png');
     //		imagepng($image);
 }
开发者ID:HivenKay,项目名称:ESalon,代码行数:30,代码来源:LfCodeimage.php


示例7: zoom

namespace common;

class upload
{
    //从tmp中移动upload
    public static function zoom(&$file, &$maxWidth = 0, &$maxHeight = 0)
    {
        list($width, $height, $im, $func, $ext) = self::_init($file);
        if (!$im) {
            \yk\log::runlog('file upload error: im not found', 'upload');
            return false;
        }
        if ($maxWidth > 0) {
            $p = max($width / $maxWidth, $height / $maxHeight);
            $dstwidth = intval($width / $p);
            $dstheight = intval($height / $p);
        } else {
            $dstwidth = $width;
            $dstheight = $height;
        }
        $maxWidth = $dstwidth;
        $maxHeight = $dstheight;
        $dstim = imagecreatetruecolor($dstwidth, $dstheight);
        imagealphablending($dstim, false);
        //关闭混杂模式,不可缺少,  PHP文档中说明: (在非混色模式下,画笔颜色连同其 alpha 通道信息一起被拷贝,替换掉目标像素。混色模式在画调色板图像时不可用。)  而且是imagesavealpha方法起作用的前置步骤.
        imagesavealpha($dstim, true);
        //保存 PNG 图像时保存完整的 alpha 通道信息
        $transparent = imagecolorallocatealpha($dstim, 255, 255, 255, 127);
        //取得一个透明的颜色,  透明度在 0-127 间
        imagefill($dstim, 0, 0, $transparent);
        imagecopyresampled($dstim, $im, 0, 0, 0, 0, $dstwidth, $dstheight, $width, $height);
        $file = uniqid() . $ext;
开发者ID:xiaoniainiu,项目名称:php-yaf-yk,代码行数:32,代码来源:upload.php


示例8: image

 private static function image($frame, $pixelPerPoint = 4, $outerFrame = 4)
 {
     $h = count($frame);
     $w = strlen($frame[0]);
     $imgW = $w + 2 * $outerFrame;
     $imgH = $h + 2 * $outerFrame;
     $base_image = imagecreatetruecolor($imgW, $imgH);
     $col[0] = ImageColorAllocate($base_image, 255, 0, 255);
     $col[1] = ImageColorAllocate($base_image, 0, 0, 0);
     imagecolortransparent($base_image, $col[0]);
     imagealphablending($base_image, true);
     imagesavealpha($base_image, true);
     //        imagefill($base_image, 0, 0, $col[0]);
     imagefill($base_image, 0, 0, 0x7fff0000);
     for ($y = 0; $y < $h; $y++) {
         for ($x = 0; $x < $w; $x++) {
             if ($frame[$y][$x] == '1') {
                 ImageSetPixel($base_image, $x + $outerFrame, $y + $outerFrame, $col[1]);
             }
         }
     }
     $target_image = ImageCreate($imgW * $pixelPerPoint, $imgH * $pixelPerPoint);
     ImageCopyResized($target_image, $base_image, 0, 0, 0, 0, $imgW * $pixelPerPoint, $imgH * $pixelPerPoint, $imgW, $imgH);
     ImageDestroy($base_image);
     return $target_image;
 }
开发者ID:aplitax,项目名称:PHPQRCode,代码行数:26,代码来源:QRimage.php


示例9: getAuthImage

 function getAuthImage($text)
 {
     $this->setpin($text);
     $im_x = 160;
     $im_y = 40;
     $im = imagecreatetruecolor($im_x, $im_y);
     $text_c = ImageColorAllocate($im, mt_rand(0, 100), mt_rand(0, 100), mt_rand(0, 100));
     $tmpC0 = mt_rand(100, 255);
     $tmpC1 = mt_rand(100, 255);
     $tmpC2 = mt_rand(100, 255);
     $buttum_c = ImageColorAllocate($im, $tmpC0, $tmpC1, $tmpC2);
     imagefill($im, 16, 13, $buttum_c);
     $font = PATH_SYS_PUBLIC . 'font-awesome/fonts/verdana.ttf';
     for ($i = 0; $i < strlen($text); $i++) {
         $tmp = substr($text, $i, 1);
         $array = array(-1, 1);
         $p = array_rand($array);
         $an = $array[$p] * mt_rand(1, 10);
         //角度
         $size = 28;
         imagettftext($im, $size, $an, 15 + $i * $size, 35, $text_c, $font, $tmp);
     }
     $distortion_im = imagecreatetruecolor($im_x, $im_y);
     imagefill($distortion_im, 16, 13, $buttum_c);
     for ($i = 0; $i < $im_x; $i++) {
         for ($j = 0; $j < $im_y; $j++) {
             $rgb = imagecolorat($im, $i, $j);
             if ((int) ($i + 20 + sin($j / $im_y * 2 * M_PI) * 10) <= imagesx($distortion_im) && (int) ($i + 20 + sin($j / $im_y * 2 * M_PI) * 10) >= 0) {
                 imagesetpixel($distortion_im, (int) ($i + 10 + sin($j / $im_y * 2 * M_PI - M_PI * 0.1) * 4), $j, $rgb);
             }
         }
     }
     //加入干扰象素;
     $count = 160;
     //干扰像素的数量
     for ($i = 0; $i < $count; $i++) {
         $randcolor = ImageColorallocate($distortion_im, mt_rand(0, 255), mt_rand(0, 255), mt_rand(0, 255));
         imagesetpixel($distortion_im, mt_rand() % $im_x, mt_rand() % $im_y, $randcolor);
     }
     $rand = mt_rand(5, 30);
     $rand1 = mt_rand(15, 25);
     $rand2 = mt_rand(5, 10);
     for ($yy = $rand; $yy <= +$rand + 2; $yy++) {
         for ($px = -80; $px <= 80; $px = $px + 0.1) {
             $x = $px / $rand1;
             if ($x != 0) {
                 $y = sin($x);
             }
             $py = $y * $rand2;
             imagesetpixel($distortion_im, $px + 80, $py + $yy, $text_c);
         }
     }
     //设置文件头;
     Header("Content-type: image/JPEG");
     //以PNG格式将图像输出到浏览器或文件;
     ImagePNG($distortion_im);
     //销毁一图像,释放与image关联的内存;
     ImageDestroy($distortion_im);
     ImageDestroy($im);
 }
开发者ID:nanfs,项目名称:lt,代码行数:60,代码来源:pin.class.php


示例10: create_image

function create_image()
{
    // hash: là mật mã
    $md5_hash = md5(rand(0, 999));
    // rand phat sinh 1 số từ 0 - 999
    // md5 sẽ mã hóa 1 số thành 1 số khác đến 32 ký tự
    $security_code = substr($md5_hash, 15, 4);
    // substr lấy 1 chuỗi con trong md5_hash, lấy từ ký tự thứ 15 và lấy 5 ký tự
    $_SESSION['security_code'] = $security_code;
    $width = 100;
    //Khai báo kích thước captcha
    $height = 30;
    $image = imagecreate($width, $height);
    $while = imagecolorallocate($image, 255, 255, 255);
    $black = imagecolorallocate($image, 0, 0, 0);
    $red = imagecolorallocate($image, 255, 255, 0);
    imagefill($image, 0, 0, $black);
    imagestring($image, 5, 30, 6, $security_code, $while);
    // 5 font size
    // 30 khoảng cách bên trái
    //khoảng cách từ trên xuống
    $captcha = imagecreatefrompng('captcha1.png');
    $font = 'arial.ttf';
    imagettftext($captcha, 23, 6, 20, 38, $black, $font, $security_code);
    header("Content-Type:image/jpeg");
    // chuyển trang web thành dạng hình jpg
    imagejpeg($captcha);
    //Tạo hình
    imagedestroy($captcha);
    // Hủy hình gốc vì đã tạo thành trang
}
开发者ID:tlcn11,项目名称:MaiTranThuy,代码行数:31,代码来源:captcha.php


示例11: __construct

 public function __construct($type = 1, $size = 6)
 {
     Oraculum_Request::init_sess();
     if (is_null(Oraculum_Request::sess("captcha"))) {
         if ($type == 3) {
             $letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
             $max = 61;
         } elseif ($type == 2) {
             $letters = 'abcdefghijklmnopqrstuvwxyz0123456789';
             $max = 35;
         } else {
             $letters = '0123456789';
             $max = 9;
         }
         $string = NULL;
         for ($i = 0; $i < $size; $i++) {
             $string .= $letters[mt_rand(0, $max)];
         }
         Oraculum_Request::setsess("captcha", $string);
     } else {
         $string = Oraculum_Request::sess("captcha");
     }
     $img = imagecreate(10 * $size, 25);
     $backcolor = imagecolorallocate($img, 255, 255, 255);
     $textcolor = imagecolorallocate($img, 00, 00, 00);
     imagefill($img, 0, 0, $backcolor);
     imagestring($img, 10, 0, 5, $string, $textcolor);
     header("Content-type: image/jpeg");
     imagejpeg($img);
 }
开发者ID:RivaldoGuimaraes,项目名称:kap-learning,代码行数:30,代码来源:captcha.php


示例12: _resize_padded

 protected function _resize_padded($canvas_w, $canvas_h, $canvas_color, $width, $height, $orig_w, $orig_h, $origin_x, $origin_y)
 {
     $src_x = $src_y = 0;
     $src_w = $orig_w;
     $src_h = $orig_h;
     $cmp_x = $orig_w / $width;
     $cmp_y = $orig_h / $height;
     // calculate x or y coordinate and width or height of source
     if ($cmp_x > $cmp_y) {
         $src_w = round($orig_w / $cmp_x * $cmp_y);
         $src_x = round(($orig_w - $orig_w / $cmp_x * $cmp_y) / 2);
     } else {
         if ($cmp_y > $cmp_x) {
             $src_h = round($orig_h / $cmp_y * $cmp_x);
             $src_y = round(($orig_h - $orig_h / $cmp_y * $cmp_x) / 2);
         }
     }
     $resized = wp_imagecreatetruecolor($canvas_w, $canvas_h);
     if ($canvas_color === 'transparent') {
         $color = imagecolorallocatealpha($resized, 255, 255, 255, 127);
     } else {
         $rgb = cnColor::rgb2hex2rgb($canvas_color);
         $color = imagecolorallocatealpha($resized, $rgb['red'], $rgb['green'], $rgb['blue'], 0);
     }
     // Fill the background of the new image with allocated color.
     imagefill($resized, 0, 0, $color);
     // Restore transparency.
     imagesavealpha($resized, TRUE);
     imagecopyresampled($resized, $this->image, $origin_x, $origin_y, $src_x, $src_y, $width, $height, $src_w, $src_h);
     if (is_resource($resized)) {
         $this->update_size($width, $height);
         return $resized;
     }
     return new WP_Error('image_resize_error', __('Image resize failed.', 'connections'), $this->file);
 }
开发者ID:VacantFuture,项目名称:Connections,代码行数:35,代码来源:class.gd.php


示例13: execute

 /**
  * Reduces colors of a given image
  *
  * @param  \Intervention\Image\Image $image
  * @return boolean
  */
 public function execute($image)
 {
     $count = $this->argument(0)->value();
     $matte = $this->argument(1)->value();
     // get current image size
     $size = $image->getSize();
     // create empty canvas
     $resource = imagecreatetruecolor($size->width, $size->height);
     // define matte
     if (is_null($matte)) {
         $matte = imagecolorallocatealpha($resource, 255, 255, 255, 127);
     } else {
         $matte = $image->getDriver()->parseColor($matte)->getInt();
     }
     // fill with matte and copy original image
     imagefill($resource, 0, 0, $matte);
     // set transparency
     imagecolortransparent($resource, $matte);
     // copy original image
     imagecopy($resource, $image->getCore(), 0, 0, 0, 0, $size->width, $size->height);
     if (is_numeric($count) && $count <= 256) {
         // decrease colors
         imagetruecolortopalette($resource, true, $count);
     }
     // set new resource
     $image->setCore($resource);
     return true;
 }
开发者ID:shubhomoy,项目名称:evolve,代码行数:34,代码来源:LimitColorsCommand.php


示例14: createCaptcha

 public function createCaptcha()
 {
     $captcha = '';
     $symbol = '0';
     $width = 420;
     $height = 70;
     $font = 'fonts/bellb.ttf';
     $fontsize = 20;
     $captchaLength = rand(1, 1);
     $im = imagecreatetruecolor($width, $height);
     $bg = imagecolorallocatealpha($im, 0, 0, 0, 127);
     imagefill($im, 0, 0, $bg);
     for ($i = 0; $i < $captchaLength; $i++) {
         $captcha .= $symbol[rand(0, strlen($symbol) - 1)];
         $x = ($width - 20) / $captchaLength * $i + 10;
         $x = rand($x, $x + 4);
         $y = $height - ($height - $fontsize) / 2;
         $curcolor = imagecolorallocate($im, rand(0, 100), rand(0, 100), rand(0, 100));
         $angle = rand(-25, 25);
         imagettftext($im, $fontsize, $angle, $x, $y, $curcolor, $font, $captcha[$i]);
     }
     session_start();
     $_SESSION['captcha'] = $captcha;
     header('Content-type: image/png');
     imagepng($im);
     imagedestroy($im);
 }
开发者ID:Arxemond777,项目名称:News,代码行数:27,代码来源:captcha.php


示例15: createBg

 private function createBg()
 {
     $this->img = imagecreatetruecolor($this->width, $this->height);
     $color = imagecolorallocate($this->img, mt_rand(157, 255), mt_rand(157, 255), mt_rand(157, 255));
     //imagefilledrectangle($this->img,0,$this->height,$this->width,0,$color);
     imagefill($this->img, 0, 0, $color);
 }
开发者ID:xiaowei520,项目名称:web_flower,代码行数:7,代码来源:Captcha.php


示例16: render_block

function render_block($left_side, $top_side, $right_side)
{
    global $size;
    $size = 2048;
    $x1 = (2 - sqrt(3)) * 0.25 * $size;
    $x2 = 0.5 * $size;
    $x3 = (2 + sqrt(3)) * 0.25 * $size;
    $y1 = 0;
    $y2 = 0.25 * $size;
    $y3 = 0.5 * $size;
    $y4 = 0.75 * $size;
    $y5 = $size;
    $first_poligon = array($x1, $y2, $x2, $y3, $x2, $y5, $x1, $y4);
    $second_poligon = array($x1, $y2, $x2, $y1, $x3, $y2, $x2, $y3);
    $third_poligon = array($x2, $y3, $x3, $y2, $x3, $y4, $x2, $y5);
    $im = imagecreatetruecolor($size, $size);
    // Transparentbackground
    imagealphablending($im, true);
    imagesavealpha($im, true);
    $trans = imagecolorallocatealpha($im, 0, 0, 0, 127);
    imagefill($im, 0, 0, $trans);
    imagetranslatedtexture($im, $first_poligon, imagelight(load_png($left_side), 96));
    imagetranslatedtexture($im, $second_poligon, load_png($top_side));
    imagetranslatedtexture($im, $third_poligon, imagelight(load_png($right_side), 64));
    return $im;
}
开发者ID:mcenderdragon,项目名称:Icon-Craft,代码行数:26,代码来源:block_renderer.php


示例17: index

 public function index()
 {
     ob_clean();
     $image_handle = imagecreatetruecolor(150, 60);
     $white = imagecolorallocate($image_handle, 255, 255, 255);
     $rndm = imagecolorallocate($image_handle, rand(64, 192), rand(64, 192), rand(64, 192));
     imagefill($image_handle, 0, 0, $white);
     $fontName = PUBLICPATH . "/fonts/elephant.ttf";
     $myX = 15;
     $myY = 30;
     $angle = 0;
     for ($x = 0; $x <= 100; $x++) {
         $myX = rand(1, 148);
         $myY = rand(1, 58);
         imageline($image_handle, $myX, $myY, $myX + rand(-5, 5), $myY + rand(-5, 5), $rndm);
     }
     $myCryptBase = tep_create_random_value(50, 'digits');
     $secure_image_hash_string = "";
     for ($x = 0; $x <= 4; $x++) {
         $dark = imagecolorallocate($image_handle, rand(5, 128), rand(5, 128), rand(5, 128));
         $capChar = substr($myCryptBase, rand(1, 35), 1);
         $secure_image_hash_string .= $capChar;
         $fs = rand(20, 26);
         $myX = 15 + ($x * 28 + rand(-5, 5));
         $myY = rand($fs + 2, 55);
         $angle = rand(-30, 30);
         ImageTTFText($image_handle, $fs, $angle, $myX, $myY, $dark, $fontName, $capChar);
     }
     $this->session->set_userdata('secure_image_hash_string', $secure_image_hash_string);
     header("Content-type: image/jpeg");
     imagejpeg($image_handle, "", 95);
     imagedestroy($image_handle);
     die;
 }
开发者ID:rongandat,项目名称:ookcart-project,代码行数:34,代码来源:secure_image.php


示例18: generateImage

 private function generateImage()
 {
     // prepare image
     $this->generatedImage = imagecreatetruecolor($this->getPixelRatio() * 5, $this->getPixelRatio() * 5);
     $rgbBackgroundColor = $this->getBackgroundColor();
     if (null === $rgbBackgroundColor) {
         $background = imagecolorallocate($this->generatedImage, 0, 0, 0);
         imagecolortransparent($this->generatedImage, $background);
     } else {
         $background = imagecolorallocate($this->generatedImage, $rgbBackgroundColor[0], $rgbBackgroundColor[1], $rgbBackgroundColor[2]);
         imagefill($this->generatedImage, 0, 0, $background);
     }
     // prepage color
     $rgbColor = $this->getColor();
     $gdColor = imagecolorallocate($this->generatedImage, $rgbColor[0], $rgbColor[1], $rgbColor[2]);
     // draw content
     foreach ($this->getArrayOfSquare() as $lineKey => $lineValue) {
         foreach ($lineValue as $colKey => $colValue) {
             if (true === $colValue) {
                 imagefilledrectangle($this->generatedImage, $colKey * $this->getPixelRatio(), $lineKey * $this->getPixelRatio(), ($colKey + 1) * $this->getPixelRatio(), ($lineKey + 1) * $this->getPixelRatio(), $gdColor);
             }
         }
     }
     return $this;
 }
开发者ID:chinazan,项目名称:zzcrm,代码行数:25,代码来源:GdGenerator.php


示例19: action_index

 /**
  * Processes incoming text
  */
 public function action_index()
 {
     $this->request->headers['Content-type'] = 'image/png';
     // Grab text and styles
     $text = arr::get($_GET, 'text');
     $styles = $_GET;
     $hover = FALSE;
     try {
         // Create image
         $img = new PNGText($text, $styles);
         foreach ($styles as $key => $value) {
             if (substr($key, 0, 6) == 'hover-') {
                 // Grab hover associated styles and override existing styles
                 $hover = TRUE;
                 $styles[substr($key, 6)] = $value;
             }
         }
         if ($hover) {
             // Create new hover image and stack it
             $hover = new PNGText($text, $styles);
             $img->stack($hover);
         }
         echo $img->draw();
     } catch (Exception $e) {
         if (Kohana::config('pngtext.debug')) {
             // Dump error message in an image form
             $img = imagecreatetruecolor(strlen($e->getMessage()) * 6, 16);
             imagefill($img, 0, 0, imagecolorallocate($img, 255, 255, 255));
             imagestring($img, 2, 0, 0, $e->getMessage(), imagecolorallocate($img, 0, 0, 0));
             echo imagepng($img);
         }
     }
 }
开发者ID:andygoo,项目名称:kohana-pngtext,代码行数:36,代码来源:pngtext.php


示例20: create_image

function create_image()
{
    // *** Generate a passcode using md5
    //	(it will be all lowercase hex letters and numbers ***
    $md5 = md5(rand(0, 9999));
    $pass = substr($md5, 10, 5);
    // *** Set the session cookie so we know what the passcode is ***
    $_SESSION["pass"] = $pass;
    // *** Create the image resource ***
    $image = ImageCreatetruecolor(100, 20);
    // *** We are making two colors, white and black ***
    $clr_white = ImageColorAllocate($image, 255, 255, 255);
    $clr_black = ImageColorAllocate($image, 0, 0, 0);
    // *** Make the background black ***
    imagefill($image, 0, 0, $clr_black);
    // *** Set the image height and width ***
    imagefontheight(15);
    imagefontwidth(15);
    // *** Add the passcode in white to the image ***
    imagestring($image, 5, 30, 3, $pass, $clr_white);
    // *** Throw in some lines to trick those cheeky bots! ***
    imageline($image, 5, 1, 50, 20, $clr_white);
    imageline($image, 60, 1, 96, 20, $clr_white);
    // *** Return the newly created image in jpeg format ***
    return imagejpeg($image);
    // *** Just in case... ***
    imagedestroy($image);
}
开发者ID:phpsa,项目名称:TheHostingTool,代码行数:28,代码来源:captcha_image.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP imagefilledarc函数代码示例发布时间:2022-05-15
下一篇:
PHP imageellipse函数代码示例发布时间: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