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

PHP imagebmp函数代码示例

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

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



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

示例1: imprimir_ticket

 public function imprimir_ticket()
 {
     // Prueba de impresión de ticket directamente a impresora
     // Crea codigo de barras
     $barras_txt = '0123456790123';
     $this->barcode->barcode_img_tipo = 'png';
     $barras = ($barrasImg = $this->barcode->create($barras_txt)) ? true : false;
     #Crea jpg
     $barrasBmp = $barras ? imagebmp('png', $barrasImg, 'assets\\tmp\\barcode.bmp') : false;
     #Convierte jpg->bmp
     // Crea código QR
     $qr_txt = 'http://www.isolution.mx';
     $qr = ($qrImg = $this->codeqr->create($qr_txt)) ? true : false;
     $qrBmp = $qr ? imagebmp('png', $qrImg, 'assets\\tmp\\qrcode.bmp') : false;
     #Convierte jpg->bmp
     // Envía datos
     $impData = array('contenido' => 'assets\\tmp\\ticket.txt', 'logo' => 'assets/images/logo.bmp', 'impresora' => 'PDFCreator', 'formato' => true, 'codebar' => $barrasBmp, 'codeqr' => $qrBmp);
     // Imprime ticket
     if ($this->impresion->enviar_a_impresora($impData)) {
         echo "Impresión enviada: " . date('Y-m-d H:i:s');
     }
     // Elimina imagenes generadas
     if ($barrasImg) {
         unlink($barrasImg);
     }
     if ($barrasBmp) {
         unlink($barrasBmp);
     }
     if ($qrImg) {
         unlink($qrImg);
     }
     if ($qrBmp) {
         unlink($qrBmp);
     }
 }
开发者ID:erick120191,项目名称:adminplayidea,代码行数:35,代码来源:test.php


示例2: save

 function save($handle, $uri = null)
 {
     if ($uri == null) {
         imagebmp($handle);
     } else {
         imagebmp($handle, $uri);
     }
 }
开发者ID:eduardosilvapereira,项目名称:mcja,代码行数:8,代码来源:BMP.php


示例3: img_thumb

 function img_thumb($target, $newcopy, $w, $h, $ext)
 {
     list($w_orig, $h_orig) = getimagesize($target);
     // get image sizes of the uploaded image
     $ratio_orig = $w_orig / $h_orig;
     // width ratio
     // figure out max height or width
     if ($w / $h > $ratio_orig) {
         $w = $h * $ratio_orig;
     } else {
         $h = $w / $ratio_orig;
     }
     $ext = strtolower($ext);
     $img = "";
     if ($ext == "gif") {
         $img = imagecreatefromgif($target);
     } else {
         if ($ext == "png") {
             $img = imagecreatefrompng($target);
         } else {
             $img = imagecreatefromjpeg($target);
         }
     }
     $tci = imagecreatetruecolor($w, $h);
     if ($ext == "gif" or $ext == "png") {
         imagecolortransparent($tci, imagecolorallocatealpha($tci, 0, 0, 0, 127));
         imagealphablending($tci, false);
         imagesavealpha($tci, true);
     }
     imagecopyresampled($tci, $img, 0, 0, 0, 0, $w, $h, $w_orig, $h_orig);
     // if($src_x<0) {
     //     $bgd = imagecolorallocate($tci, 255, 255, 255);
     //     imagefill($tci, 0, 0, $bgd);
     // }
     if ($ext == "gif") {
         imagegif($tci, $newcopy);
     } else {
         if ($ext == "png") {
             imagepng($tci, $newcopy);
         } else {
             if ($ext == "bmp") {
                 imagebmp($tci, $newcopy);
             } else {
                 imagejpeg($tci, $newcopy, 84);
             }
         }
     }
 }
开发者ID:altim,项目名称:kallababy,代码行数:48,代码来源:upload.php


示例4: helper_watermark

function helper_watermark($name, $ext)
{
    ($hook = kleeja_run_hook('helper_watermark_func')) ? eval($hook) : null;
    //run hook
    #is this file really exsits ?
    if (!file_exists($name)) {
        return;
    }
    $src_logo = $logo_path = false;
    if (file_exists(dirname(__FILE__) . '/../../images/watermark.png')) {
        $logo_path = dirname(__FILE__) . '/../../images/watermark.png';
        $src_logo = imagecreatefrompng($logo_path);
    } elseif (file_exists(dirname(__FILE__) . '/../../images/watermark.gif')) {
        $logo_path = dirname(__FILE__) . '/../../images/watermark.gif';
        $src_logo = imagecreatefromgif($logo_path);
    }
    #no watermark pic
    if (!$src_logo) {
        return;
    }
    #if there is imagick lib, then we should use it
    if (function_exists('phpversion') && phpversion('imagick')) {
        helper_watermark_imagick($name, $ext, $logo_path);
        return;
    }
    #now, lets work and detect our image extension
    if (strpos($ext, 'jp') !== false) {
        $src_img = @imagecreatefromjpeg($name);
    } elseif (strpos($ext, 'png') !== false) {
        $src_img = @imagecreatefrompng($name);
    } elseif (strpos($ext, 'gif') !== false) {
        return;
        $src_img = @imagecreatefromgif($name);
    } elseif (strpos($ext, 'bmp') !== false) {
        if (!defined('BMP_CLASS_INCLUDED')) {
            include dirname(__FILE__) . '/BMP.php';
            define('BMP_CLASS_INCLUDED', true);
        }
        $src_img = imagecreatefrombmp($name);
    } else {
        return;
    }
    #detect width, height for the image
    $bwidth = @imageSX($src_img);
    $bheight = @imageSY($src_img);
    #detect width, height for the watermark image
    $lwidth = @imageSX($src_logo);
    $lheight = @imageSY($src_logo);
    if ($bwidth > $lwidth + 5 && $bheight > $lheight + 5) {
        #where exaxtly do we have to make the watermark ..
        $src_x = $bwidth - ($lwidth + 5);
        $src_y = $bheight - ($lheight + 5);
        #make it now, watermark it
        @ImageAlphaBlending($src_img, true);
        @ImageCopy($src_img, $src_logo, $src_x, $src_y, 0, 0, $lwidth, $lheight);
        if (strpos($ext, 'jp') !== false) {
            @imagejpeg($src_img, $name);
        } elseif (strpos($ext, 'png') !== false) {
            @imagepng($src_img, $name);
        } elseif (strpos($ext, 'gif') !== false) {
            @imagegif($src_img, $name);
        } elseif (strpos($ext, 'bmp') !== false) {
            @imagebmp($src_img, $name);
        }
    } else {
        #image is not big enough to watermark it
        return false;
    }
}
开发者ID:Saleh7,项目名称:Kleeja,代码行数:69,代码来源:watermark.php


示例5: imagebmp

 public static function imagebmp(&$img, $filename = false)
 {
     return imagebmp($img, $filename);
 }
开发者ID:Saleh7,项目名称:Kleeja,代码行数:4,代码来源:BMP.php


示例6: makeThumbWatermark


//.........这里部分代码省略.........
         ImageCopyResampled($src_image, $img, 0, 0, 0, 0, $width, $height, $image_info["width"], $image_info["height"]);
     } else {
         $src_image = imagecreate($width, $height);
         ImageCopyResized($src_image, $img, 0, 0, 0, 0, $width, $height, $image_info["width"], $image_info["height"]);
     }
     $src_image_w = ImageSX($src_image);
     $src_image_h = ImageSY($src_image);
     if ($this->wm_image_name) {
         $wm_image_info = $this->getInfo($this->wm_image_name);
         if (!$wm_image_info) {
             return false;
         }
         $wm_image_type = $wm_image_info["type"];
         $wm_image = $this->createImage($wm_image_type, $this->wm_image_name);
         $wm_image_w = ImageSX($wm_image);
         $wm_image_h = ImageSY($wm_image);
         $temp_wm_image = $this->getPos($src_image_w, $src_image_h, $this->wm_image_pos, $wm_image);
         if ($this->emboss && function_exists("imagefilter")) {
             imagefilter($wm_image, IMG_FILTER_EMBOSS);
             $bgcolor = imagecolorclosest($wm_image, 0x7f, 0x7f, 0x7f);
             imagecolortransparent($wm_image, $bgcolor);
         }
         if (function_exists("ImageAlphaBlending") && IMAGETYPE_PNG == $wm_image_info['type']) {
             ImageAlphaBlending($src_image, true);
         }
         $wm_image_x = $temp_wm_image["dest_x"];
         $wm_image_y = $temp_wm_image["dest_y"];
         if (IMAGETYPE_PNG == $wm_image_info['type']) {
             imageCopy($src_image, $wm_image, $wm_image_x, $wm_image_y, 0, 0, $wm_image_w, $wm_image_h);
         } else {
             imageCopyMerge($src_image, $wm_image, $wm_image_x, $wm_image_y, 0, 0, $wm_image_w, $wm_image_h, $this->wm_image_transition);
         }
     }
     if ($this->wm_text) {
         $this->wm_text = $this->wm_text;
         $temp_wm_text = $this->getPos($src_image_w, $src_image_h, $this->wm_image_pos);
         $wm_text_x = $temp_wm_text["dest_x"];
         $wm_text_y = $temp_wm_text["dest_y"];
         if (preg_match("/([a-f0-9][a-f0-9])([a-f0-9][a-f0-9])([a-f0-9][a-f0-9])/i", $this->wm_text_color, $color)) {
             $red = hexdec($color[1]);
             $green = hexdec($color[2]);
             $blue = hexdec($color[3]);
             $wm_text_color = imagecolorallocate($src_image, $red, $green, $blue);
         } else {
             $wm_text_color = imagecolorallocate($src_image, 255, 255, 255);
         }
         imagettftext($src_image, $this->wm_text_size, $this->wm_angle, $wm_text_x, $wm_text_y, $wm_text_color, $this->wm_text_font, $this->wm_text);
     }
     if ($this->save_file) {
         switch ($src_image_type) {
             case 1:
                 if ($this->gif_enable) {
                     $src_img = ImageGIF($src_image, $this->save_file);
                 } else {
                     $src_img = ImagePNG($src_image, $this->save_file);
                 }
                 break;
             case 2:
                 $src_img = ImageJPEG($src_image, $this->save_file, $this->jpeg_quality);
                 break;
             case 3:
                 $src_img = ImagePNG($src_image, $this->save_file);
                 break;
             default:
                 $src_img = ImageJPEG($src_image, $this->save_file, $this->jpeg_quality);
                 break;
         }
     } else {
         switch ($src_image_type) {
             case 1:
                 if ($this->gif_enable) {
                     header("Content-type: image/gif");
                     $src_img = ImageGIF($src_image);
                 } else {
                     header("Content-type: image/png");
                     $src_img = ImagePNG($src_image);
                 }
                 break;
             case 2:
                 header("Content-type: image/jpeg");
                 $src_img = ImageJPEG($src_image, "", $this->jpeg_quality);
                 break;
             case 3:
                 header("Content-type: image/png");
                 $src_img = ImagePNG($src_image);
                 break;
             case 6:
                 header("Content-type: image/bmp");
                 $src_img = imagebmp($src_image);
                 break;
             default:
                 header("Content-type: image/jpeg");
                 $src_img = ImageJPEG($src_image, "", $this->jpeg_quality);
                 break;
         }
     }
     imagedestroy($src_image);
     imagedestroy($img);
     return true;
 }
开发者ID:noikiy,项目名称:MyShop,代码行数:101,代码来源:mdl.gdimage.php


示例7: imagerotate

        //print_r($data);
        // Rotate
        $degrees = 90;
        $rotate = imagerotate($im, $degrees, 0);
        switch ($type) {
            case 1:
                imagegif($rotate, $filepath, 100);
                break;
            case 2:
                imagejpeg($rotate, $filepath, 100);
                break;
            case 3:
                imagepng($rotate, $filepath, 100);
                break;
            case 6:
                imagebmp($rotate, $filepath, 100);
                break;
        }
        imagedestroy($im);
        imagedestroy($rotate);
    }
}
?>

<!doctype html>
<html lang="en">
	<head>
		<meta charset="utf-8">
		<title> Profile </title>
		
		<meta name="mobile-web-app-capable" content="yes">
开发者ID:JaimeA,项目名称:SkunkWrx,代码行数:31,代码来源:profile.php


示例8: resizeImage

 /**
  * [resizeImage description]
  * @param  [type] $im        [源目标图片]
  * @param  [type] $maxwidth  [最大宽度]
  * @param  [type] $maxheight [最大高度]
  * @param  [type] $name      [图片名]
  * @param  [type] $filetype  [图片类型]
  * @param  [type] $tmp_name  [上传的文件的临时路径]
  * @return [type]            [成功true]
  */
 function resizeImage($tmp_name, $maxwidth, $maxheight, $name, $filetype)
 {
     try {
         $img_info = getimagesize($tmp_name);
         if (!in_array($img_info['mime'], array('image/jpeg', 'image/png', 'image/bmp', 'image/gif', 'image/pjpeg', 'image/jpg', 'image/x-png'))) {
             $this->errmsg = '只支持上传图片';
             return FALSE;
         }
         $pic_width = $img_info[0];
         $pic_height = $img_info[1];
         if ($maxwidth && $pic_width > $maxwidth || $maxheight && $pic_height > $maxheight) {
             $resizeheightTag = $resizewidthTag = false;
             if ($maxwidth && $pic_width > $maxwidth) {
                 $widthratio = $maxwidth / $pic_width;
                 $resizewidthTag = true;
             }
             if ($maxheight && $pic_height > $maxheight) {
                 $heightratio = $maxheight / $pic_height;
                 $resizeheightTag = true;
             }
             if ($resizewidthTag && $resizeheightTag) {
                 if ($widthratio < $heightratio) {
                     $ratio = $widthratio;
                 } else {
                     $ratio = $heightratio;
                 }
             }
             if ($resizewidthTag && !$resizeheightTag) {
                 $ratio = $widthratio;
             }
             if ($resizeheightTag && !$resizewidthTag) {
                 $ratio = $heightratio;
             }
             $newwidth = $pic_width * $ratio;
             $newheight = $pic_height * $ratio;
             $newim = imagecreatetruecolor($newwidth, $newheight);
             switch ($img_info['mime']) {
                 case "image/gif":
                     $images = imagecreatefromgif($tmp_name);
                     break;
                 case "image/pjpeg":
                 case "image/jpeg":
                 case "image/jpg":
                     $images = imagecreatefromjpeg($tmp_name);
                     break;
                 case "image/png":
                 case "image/x-png":
                     $images = imagecreatefrompng($tmp_name);
                     break;
                 case "image/bmp":
                     $images = imageCreateFromBmp($tmp_name);
                     break;
             }
             imagecopyresampled($newim, $images, 0, 0, 0, 0, $newwidth, $newheight, $pic_width, $pic_height);
             $name = $this->save_path . $name . $filetype;
             switch ($img_info['mime']) {
                 case "image/gif":
                     imagegif($newim, $name);
                     break;
                 case "image/pjpeg":
                 case "image/jpeg":
                 case "image/jpg":
                     imagejpeg($newim, $name, 100);
                     break;
                 case "image/png":
                 case "image/x-png":
                     imagepng($newim, $name);
                     break;
                 case "image/bmp":
                     imagebmp($newim, $name);
                     break;
             }
             imagedestroy($newim);
         } else {
             if (!copy($tmp_name, $this->save_path . $name . $filetype)) {
                 return false;
             }
         }
         return TRUE;
     } catch (E $e) {
         return FALSE;
     }
 }
开发者ID:nicklos17,项目名称:littlemall,代码行数:93,代码来源:GoodsImgUpload.php


示例9: to

 public function to($src)
 {
     imagebmp($this->image, $src);
 }
开发者ID:niksfish,项目名称:Tinyboard,代码行数:4,代码来源:image.php


示例10: ImageResize

 function ImageResize($srcFile, $toW, $toH, $toFile = "")
 {
     global $cfg_photo_type;
     if ($toFile == '') {
         $toFile = $srcFile;
     }
     $info = '';
     $srcInfo = GetImageSize($srcFile, $info);
     switch ($srcInfo[2]) {
         case 1:
             if (!$cfg_photo_type['gif']) {
                 return FALSE;
             }
             $im = imagecreatefromgif($srcFile);
             break;
         case 2:
             if (!$cfg_photo_type['jpeg']) {
                 return FALSE;
             }
             $im = imagecreatefromjpeg($srcFile);
             break;
         case 3:
             if (!$cfg_photo_type['png']) {
                 return FALSE;
             }
             $im = imagecreatefrompng($srcFile);
             break;
         case 6:
             if (!$cfg_photo_type['bmp']) {
                 return FALSE;
             }
             $im = imagecreatefromwbmp($srcFile);
             break;
     }
     $srcW = ImageSX($im);
     $srcH = ImageSY($im);
     if ($srcW <= $toW && $srcH <= $toH) {
         return TRUE;
     }
     $toWH = $toW / $toH;
     $srcWH = $srcW / $srcH;
     if ($toWH <= $srcWH) {
         $ftoW = $toW;
         $ftoH = $ftoW * ($srcH / $srcW);
     } else {
         $ftoH = $toH;
         $ftoW = $ftoH * ($srcW / $srcH);
     }
     if ($srcW > $toW || $srcH > $toH) {
         if (function_exists("imagecreateTRUEcolor")) {
             @($ni = imagecreateTRUEcolor($ftoW, $ftoH));
             if ($ni) {
                 imagecopyresampled($ni, $im, 0, 0, 0, 0, $ftoW, $ftoH, $srcW, $srcH);
             } else {
                 $ni = imagecreate($ftoW, $ftoH);
                 imagecopyresized($ni, $im, 0, 0, 0, 0, $ftoW, $ftoH, $srcW, $srcH);
             }
         } else {
             $ni = imagecreate($ftoW, $ftoH);
             imagecopyresized($ni, $im, 0, 0, 0, 0, $ftoW, $ftoH, $srcW, $srcH);
         }
         switch ($srcInfo[2]) {
             case 1:
                 imagegif($ni, $toFile);
                 break;
             case 2:
                 imagejpeg($ni, $toFile, 85);
                 break;
             case 3:
                 imagepng($ni, $toFile);
                 break;
             case 6:
                 imagebmp($ni, $toFile);
                 break;
             default:
                 return FALSE;
         }
         imagedestroy($ni);
     }
     imagedestroy($im);
     return TRUE;
 }
开发者ID:lz1988,项目名称:stourwebcms,代码行数:82,代码来源:image.helper.php


示例11: replace_pictures

 /**
  * replaces all pictures of $this-user with a dummy for the given object-type
  * @param int $object_type object_types-id from table object_types
  * @return bool true, if replacement worked, false otherwise
  */
 function replace_pictures($object_type)
 {
     // get optionsarray
     global $opt;
     // load bmp-support
     require_once $opt['rootpath'] . 'lib2/imagebmp.inc.php';
     // paths cleared by trailing '/'
     if (substr($opt['logic']['pictures']['dir'], -1) != '/') {
         $picpath = $opt['logic']['pictures']['dir'];
     } else {
         $picpath = substr($opt['logic']['pictures']['dir'], 0, -1);
     }
     $thumbpath = "{$picpath}/thumbs";
     $pdummy = isset($opt['logic']['pictures']['dummy']);
     if ($pdummy && isset($opt['logic']['pictures']['dummy']['bgcolor']) && is_array($opt['logic']['pictures']['dummy']['bgcolor'])) {
         $dummybg = $opt['logic']['pictures']['dummy']['bgcolor'];
     } else {
         $dummybg = array(255, 255, 255);
     }
     if ($pdummy && isset($opt['logic']['pictures']['dummy']['text'])) {
         $dummytext = $opt['logic']['pictures']['dummy']['text'];
     } else {
         $dummytext = '';
     }
     if ($pdummy && isset($opt['logic']['pictures']['dummy']['textcolor']) && is_array($opt['logic']['pictures']['dummy']['textcolor'])) {
         $dummytextcolor = $opt['logic']['pictures']['dummy']['textcolor'];
     } else {
         $dummytextcolor = array(0, 0, 0);
     }
     $tmh = 0;
     $tmw = 0;
     /*
      * check log or cache
      */
     if ($object_type == OBJECT_CACHE) {
         // get filenames of the pictures of $this' caches
         $rs = sql("SELECT `pictures`.`url` " . "FROM `pictures`,`caches` " . "WHERE `caches`.`cache_id`=`pictures`.`object_id`" . " AND `pictures`.`object_type`='&1' AND `caches`.`user_id`='&2'", OBJECT_CACHE, $this->getUserId());
     } elseif ($object_type == OBJECT_CACHELOG) {
         // get filenames of the pictures of $this' logs
         $rs = sql("SELECT `pictures`.`url` " . "FROM `pictures`,`cache_logs` " . "WHERE `cache_logs`.`id`=`pictures`.`object_id`" . " AND `pictures`.`object_type`='&1' AND `cache_logs`.`user_id`='&2'", OBJECT_CACHELOG, $this->getUserId());
     }
     // set thumb-dimensions
     $tmh = $opt['logic']['pictures']['thumb_max_height'];
     $tmw = $opt['logic']['pictures']['thumb_max_width'];
     $filenames = array();
     while ($url = sql_fetch_array($rs, MYSQL_NUM)) {
         $filenames[] = substr($url['url'], -40);
     }
     // free result
     sql_free_result($rs);
     /*
      * walk through filenames and replace original
      */
     // check if there is something to replace
     if (count($filenames) > 0) {
         foreach ($filenames as $fn) {
             // get uuid and extension
             $uuid = substr($fn, 0, 36);
             $ext = substr($fn, -3);
             $thumb_dir1 = substr($uuid, 0, 1);
             $thumb_dir2 = substr($uuid, 1, 1);
             // read original size
             if (file_exists("{$picpath}/{$fn}")) {
                 list($w, $h, $t, $attr) = getimagesize("{$picpath}/{$fn}");
             } else {
                 $w = 600;
                 $h = 480;
             }
             // create new image
             $im = imagecreatetruecolor($w, $h);
             // allocate colors
             $col_bg = imagecolorallocate($im, $dummybg[0], $dummybg[1], $dummybg[2]);
             $col_text = imagecolorallocate($im, $dummytextcolor[0], $dummytextcolor[1], $dummytextcolor[2]);
             // fill bg
             imagefill($im, 0, 0, $col_bg);
             // check for replacement-image
             if ($pdummy && isset($opt['logic']['pictures']['dummy']['replacepic']) && $opt['logic']['pictures']['dummy']['replacepic'] != $opt['rootpath'] . 'images/' && file_exists($opt['logic']['pictures']['dummy']['replacepic'])) {
                 // get dimensions of the replacement
                 list($rw, $rh, $rt, $rattr) = getimagesize($opt['logic']['pictures']['dummy']['replacepic']);
                 $rwh = 0;
                 if ($rw > $rh) {
                     $rwh = $rh;
                 } else {
                     $rwh = $rw;
                 }
                 // check dimensions of original and set replacement size
                 $rsize = 0;
                 if ($w > $h) {
                     if ($h * 0.85 > $rwh) {
                         $rsize = $rwh;
                     } else {
                         $rsize = $h * 0.9;
                     }
                 } else {
                     if ($w * 0.85 > $rwh) {
//.........这里部分代码省略.........
开发者ID:harrieklomp,项目名称:oc-server3,代码行数:101,代码来源:user.class.php


示例12: imagecreatefromjpeg

        $img = imagecreatefromjpeg($fil);
        $new_image_ext = 'jpg';
}
if ($sorthvid == "1") {
    imagefilter($img, IMG_FILTER_GRAYSCALE);
}
imagefilter($img, IMG_FILTER_BRIGHTNESS, $lysbalance);
imagefilter($img, IMG_FILTER_CONTRAST, $kontrast);
switch ($type) {
    case 'jpeg':
        imagejpeg($img, $fil);
        break;
    case 'png':
        imagepng($img, $fil);
        break;
    case 'bmp':
        imagebmp($img, $fil);
        break;
    case 'gif':
        imagegif($img, $fil);
        break;
    case 'vnd.wap.wbmp':
        imagewbmp($img, $fil);
        break;
    case 'xbm':
        imagexbm($img, $fil);
        break;
    default:
        imagejpeg($img, $fil);
}
imagedestroy($img);
开发者ID:benjaco,项目名称:fileeater,代码行数:31,代码来源:coloreidting.php


示例13: imagecopyresampled

         } else {
             $newheight = $height;
         }
         $destimg = @imagecreatetruecolor(100, $newheight);
         imagecopyresampled($destimg, $orig_image, 0, 0, 0, 0, 100, $newheight, imagesx($orig_image), imagesy($orig_image));
         if ($ext == 'jpg' or $ext == 'jpeg') {
             @imagejpeg($destimg, $dl->url . $thumb);
         } else {
             if ($ext == 'png') {
                 @imagepng($destimg, $dl->url . $thumb);
             } else {
                 if ($ext == 'gif') {
                     @imagegif($destimg, $dl->url . $thumb);
                 } else {
                     if ($ext == 'bmp') {
                         @imagebmp($destimg, $dl->url . $thumb);
                     }
                 }
             }
         }
         @imagedestroy($destimg);
         $db->query_write("INSERT INTO " . TABLE_PREFIX . "dl_images (`file`,`name`,`thumb`,`uploader`,`uploaderid`,`date`) VALUES(" . $file['id'] . "," . $db->sql_prepare($newfilename) . "," . $db->sql_prepare($thumb) . "," . $db->sql_prepare($vbulletin->userinfo['username']) . "," . $vbulletin->userinfo['userid'] . "," . $db->sql_prepare(TIMENOW) . ")");
         eval(print_standard_redirect('ecdownloads_msg_image_added', true, true));
     }
 }
 if ($_GET['act'] == 'delimg') {
     $image = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "dl_images WHERE `id` = " . $db->sql_prepare($_GET['img']));
     if ($permissions['ecdownloadpermissions'] & $vbulletin->bf_ugp['ecdownloadpermissions']['caneditallfiles'] or $permissions['ecdownloadpermissions'] & $vbulletin->bf_ugp['ecdownloadpermissions']['caneditownfiles'] and ($image['uploaderid'] == $vbulletin->userinfo['userid'] and $file['uploaderid'] == $vbulletin->userinfo['userid'])) {
         $db->query_write("DELETE FROM " . TABLE_PREFIX . "dl_images WHERE `id` = " . $db->sql_prepare($image['id']));
         @unlink($dl->url . $image['name']);
         @unlink($dl->url . $image['thumb']);
开发者ID:holandacz,项目名称:nb4,代码行数:31,代码来源:downloads.php


示例14: img_thumb

 function img_thumb($target, $newcopy, $w, $h, $ext)
 {
     list($w_orig, $h_orig) = getimagesize($target);
     // get image sizes of the uploaded image
     $wr = $w_orig / $w;
     // get the width ratio
     $hr = $h_orig / $h;
     // get the height ratio
     $src_x = 0;
     // start our crop x source at 0
     $src_y = 0;
     // start our crop y source at 0
     // figure out if we need to crop the height or width to match our destination size ratio
     if ($hr < $wr) {
         // perform if the height is the limiting factor
         $ow = $w_orig;
         // store our original width for later use
         $w_orig = $w * $hr;
         // new original width
         $src_x = ($ow - $w_orig) / 2;
         // our new value to center crop the width
     }
     if ($wr < $hr) {
         // perform if the width is the limiting factor
         $oh = $h_orig;
         // store our original width for later use
         $h_orig = $h * $wr;
         // new original height
         $src_y = ($oh - $h_orig) / 2;
         // our new value to center crop the height
     }
     $ext = strtolower($ext);
     $img = "";
     if ($ext == "gif") {
         $img = imagecreatefromgif($target);
     } else {
         if ($ext == "png") {
             $img = imagecreatefrompng($target);
         } else {
             $img = imagecreatefromjpeg($target);
         }
     }
     $tci = imagecreatetruecolor($w, $h);
     if ($ext == "gif" or $ext == "png") {
         imagecolortransparent($tci, imagecolorallocatealpha($tci, 0, 0, 0, 127));
         imagealphablending($tci, false);
         imagesavealpha($tci, true);
     }
     imagecopyresampled($tci, $img, 0, 0, $src_x, $src_y, $w, $h, $w_orig, $h_orig);
     // if($src_x<0) {
     //     $bgd = imagecolorallocate($tci, 255, 255, 255);
     //     imagefill($tci, 0, 0, $bgd);
     // }
     if ($ext == "gif") {
         imagegif($tci, $newcopy);
     } else {
         if ($ext == "png") {
             imagepng($tci, $newcopy);
         } else {
             if ($ext == "bmp") {
                 imagebmp($tci, $newcopy);
             } else {
                 imagejpeg($tci, $newcopy, 84);
             }
         }
     }
 }
开发者ID:altim,项目名称:kallababy,代码行数:67,代码来源:uploadgallery.php


示例15: check_imagick_rotate

function check_imagick_rotate()
{
    $pic_path = MooGetGPC('pic_path', 'string', 'G');
    $id = MooGetGPC('id', 'integer', 'G');
    $uid = MooGetGPC('uid', 'integer', 'G');
    $degrees = 90;
    $file = explode('.', $pic_path);
    //	var_dump($file);exit;
    $new_file = '../' . $file[0] . '.' . $file[1];
    $pic_path = '../' . $pic_path;
    $source = imagecreatefromjpeg($pic_path);
    $rotate = imagerotate($source, $degrees, 0);
    //	var_dump($pic_path);
    list($imagewidth, $imageheight, $imageType) = getimagesize($pic_path);
    $imageType = image_type_to_mime_type($imageType);
    switch ($imageType) {
        case "image/gif":
            imagegif($rotate, $new_file, 100);
            break;
        case "image/pjpeg":
        case "image/jpeg":
        case "image/jpg":
            imagejpeg($rotate, $new_file, 100);
            break;
        case "image/png":
        case "image/x-png":
            imagepng($rotate, $new_file, 100);
            break;
        case "image/bmp":
            imagebmp($rotate, $new_file, 100);
            break;
    }
    //var_dump($new_file);exit;
    header('location:index.php?action=check&h=photo&type=show&id=100004&uid=100004');
}
开发者ID:noikiy,项目名称:zays,代码行数:35,代码来源:check_bak.php


示例16: changesize

function changesize($image, $path, $x, $y, $width, $height, $uid, $sizearray, $namearray)
{
    list($imagewidth, $imageheight, $imageType) = getimagesize($image);
    $imageType = image_type_to_mime_type($imageType);
    $userpath = $uid * 3;
    if (!file_exists($path)) {
        mkdir($path, 0777);
    }
    for ($i = 0; $i < count($sizearray); $i++) {
        $new_Image = imagecreatetruecolor($sizearray[$i]['width'], $sizearray[$i]['height']);
        switch ($imageType) {
            case "image/gif":
                $source = imagecreatefromgif($image);
                $thumb_image_name = $path . "/" . $userpath . "_" . $namearray[$i] . ".gif";
                break;
            case "image/pjpeg":
            case "image/jpeg":
            case "image/jpg":
                $source = imagecreatefromjpeg($image);
                $thumb_image_name = $path . "/" . $userpath . "_" . $namearray[$i] . ".jpg";
                break;
            case "image/png":
            case "image/x-png":
                $source = imagecreatefrompng($image);
                $thumb_image_name = $path . "/" . $userpath . "_" . $namearray[$i] . ".png";
                break;
            default:
                exit("不支持该图片格式:{$imageType} ,请禁止通过该图片的审核");
                /* case "image/x-bmp":
                	  case "image/x-ms-bmp":
                          case "image/bmp":
                             $source=ImageCreateFromBMP($image);
                             $thumb_image_name=$path."/".$userpath."_".$namearray[$i].".bmp"; */
        }
        imagecopyresampled($new_Image, $source, 0, 0, $x, $y, $sizearray[$i]['width'], $sizearray[$i]['height'], $width, $height);
        switch ($imageType) {
            case "image/gif":
                imagegif($new_Image, $thumb_image_name);
                break;
            case "image/pjpeg":
            case "image/jpeg":
            case "image/jpg":
                imagejpeg($new_Image, $thumb_image_name, 90);
                break;
            case "image/png":
            case "image/x-png":
                imagepng($new_Image, $thumb_image_name);
                break;
            case "image/x-bmp":
            case "image/x-ms-bmp":
            case "image/bmp":
                imagebmp($new_Image, $thumb_image_name);
                break;
        }
        /*$first = new Imagick($thumb_image_name);//写入水印
          $second = new Imagick('../public/system/images/logo_xxz.png');
          $second->setImageOpacity (0.4);//设置透明度
          $dw = new ImagickDraw();
          $dw->setGravity(Imagick::GRAVITY_SOUTHEAST);//设置位置
          $dw->composite($second->getImageCompose(),0,0,50,0,$second);
          $first->drawImage($dw);
          $first->writeImage($thumb_image_name);*/
        chmod($thumb_image_name, 0777);
    }
    return true;
}
开发者ID:noikiy,项目名称:zays,代码行数:66,代码来源:function.php


示例17: helper_thumb

/**
 * Creates a resized image
 * @example createthumb('pics/apple.jpg','thumbs/tn_apple.jpg',100,100);
 */
function helper_thumb($source_path, $ext, $dest_image, $dw, $dh)
{
    #no file, quit it
    if (!file_exists($source_path)) {
        return;
    }
    #check width, height
    if (intval($dw) == 0 || intval($dw) < 10) {
        $dw = 100;
    }
    if (intval($dh) == 0 || intval($dh) < 10) {
        $dh = $dw;
    }
    #if there is imagick lib, then we should use it
    if (function_exists('phpversion') && phpversion('imagick')) {
        helper_thumb_imagick($source_path, $ext, $dest_image, $dw, $dh);
        return;
    }
    //get file info
    list($source_width, $source_height, $source_type) = array(false, false, false);
    if (function_exists('getimagesize')) {
        list($source_width, $source_height, $source_type) = getimagesize($source_path);
    }
    if (!function_exists('imagecreatefromjpeg')) {
        return;
    }
    switch (strtolower(preg_replace('/^.*\\./', '', $source_path))) {
        case 'gif':
            $source_gdim = imagecreatefromgif($source_path);
            break;
        case 'jpg':
        case 'jpeg':
            $source_gdim = imagecreatefromjpeg($source_path);
            break;
        case 'png':
            $source_gdim = imagecreatefrompng($source_path);
            break;
        case 'bmp':
            if (!defined('BMP_CLASS_INCLUDED')) {
                include dirname(__FILE__) . '/BMP.php';
                define('BMP_CLASS_INCLUDED', true);
            }
            $source_gdim = imagecreatefrombmp($source_path);
            break;
    }
    $source_width = !$source_width ? ImageSX($source_gdim) : $source_width;
    $source_height = !$source_height ? ImageSY($source_gdim) : $source_height;
    $source_aspect_ratio = $source_width / $source_height;
    $desired_aspect_ratio = $dw / $dh;
    if ($source_aspect_ratio > $desired_aspect_ratio) {
        // Triggered when source image is wider
        $temp_height = $dh;
        $temp_width = (int) ($dh * $source_aspect_ratio);
    } else {
        // Triggered otherwise (i.e. source image is similar or taller)
        $temp_width = $dw;
        $temp_height = (int) ($dw / $source_aspect_ratio);
    }
    // Resize the image into a temporary GD image
    $temp_gdim = imagecreatetruecolor($temp_width, $temp_height);
    imagecopyresampled($temp_gdim, $source_gdim, 0, 0, 0, 0, $temp_width, $temp_height, $source_width, $source_height);
    // Copy cropped region from temporary image into the desired GD image
    $x0 = ($temp_width - $dw) / 2;
    $y0 = ($temp_height - $dh) / 2;
    $desired_gdim = imagecreatetruecolor($dw, $dh);
    imagecopy($desired_gdim, $temp_gdim, 0, 0, $x0, $y0, $dw, $dh);
    // Create thumbnail
    switch (strtolower(preg_replace('/^.*\\./', '', $dest_image))) {
        case 'jpg':
        case 'jpeg':
            $return = @imagejpeg($desired_gdim, $dest_image, 90);
            break;
        case 'png':
            $return = @imagepng($desired_gdim, $dest_image);
            break;
        case 'gif':
            $return = @imagegif($desired_gdim, $dest_image);
            break;
        case 'bmp':
            $return = @imagebmp($desired_gdim, $dest_image);
            break;
        default:
            // Unsupported format
            $return = false;
            break;
    }
    @imagedestroy($desired_gdim);
    @imagedestroy($src_img);
    return $return;
}
开发者ID:Saleh7,项目名称:Kleeja,代码行数:94,代码来源:thumbs.php


示例18: resizePicCrop

 public static function resizePicCrop($input, $output, $width, $height, $raz)
 {
     /*if (file_exists ( $output ))
     		unlink ( $output );*/
     $size = getimagesize($input);
     $w = $size[0];
     $h = $size[1];
     if ($height == '') {
         $height = $h;
     }
     if ($width == '') {
         $width = $w;
     }
     if ($w > $h) {
         if ($h < $height) {
             $a = 1;
             $newy = $h;
         } else {
             $a = $height / $h;
             $newy = $height;
         }
         $newx = $a * $w;
     } else {
         if ($w < $width) {
             $a = 1;
             $newx = $w;
         } else {
             $a = $width / $w;
             $newx = $width;
         }
         $newy = $a * $h;
     }
     if ($newx < $width) {
         if ($w < $width) {
             $a = 1;
             $newx = $w;
         } else {
             $a = $width / $w;
             $newx = $width;
         }
         $newy = $a * $h;
     }
     if ($newy < $height) {
         if ($h < $height) {
             $a = 1;
             $newy = $h;
         } else {
             $a = $height / $h;
             $newy = $height;
         }
         $newx = $a * $w;
     }
     $source = imagecreatefromstring(file_get_contents($input)) or die('Cannot load original Image');
     $target = imagecreatetruecolor($newx, $newy);
     imagealphablending($target, true);
     imagecopyresampled($target, $source, 0, 0, 0, 0, $newx, $newy, $size[0], $size[1]);
     if ($newx < $width) {
         $width = $newx;
     }
     if ($newy < $height) {
         $height = $newy;
     }
     $left = 0;
     $top = 0;
     if ($newx - $width > 0) {
         $left = ($newx - $width) / 2;
     }
     if ($newy - $height > 0) {
         $top = ($newy - $height) / 2;
     }
     //$source = imagecreatefromstring(file_get_contents($input)) or die ( 'Cannot load original Image' );
     $target2 = imagecreatetruecolor($width, $height);
     imagealphablending($target2, true);
     imagecopy($target2, $target, 0, 0, $left, $top, $width, $height) or die('Cannot copy');
     if ($raz == "png") {
         imagepng($target2, $output);
     } elseif ($raz == "gif") {
         imagegif($target2, $output);
     } elseif ($raz == "bmp") {
         imagebmp($target2, $output);
     } else {
         imagejpeg($target2, $output);
     }
     imagedestroy($target);
     imagedestroy($target2);
     imagedestroy($source);
 }
开发者ID:sov-20-07,项目名称:billing,代码行数:87,代码来源:Funcs.php


示例19: create


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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