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


PHP imagecreatefromgd2函数代码示例

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


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

示例1: readImageFromUri

 /**
  * Read image
  *
  * @param   string uri
  * @return  resource
  * @throws  img.ImagingException
  */
 public function readImageFromUri($uri)
 {
     if (false === ($r = imagecreatefromgd2($uri))) {
         $e = new \img\ImagingException('Cannot read image from "' . $uri . '"');
         \xp::gc(__FILE__);
         throw $e;
     }
     return $r;
 }
开发者ID:xp-framework,项目名称:imaging,代码行数:16,代码来源:GD2StreamReader.class.php

示例2: readImage0

 /**
  * Read image via imagecreatefromgd2()
  *
  * @param   string uri
  * @return  resource
  * @throws  img.ImagingException
  */
 protected function readImage0($uri)
 {
     if (FALSE === ($r = imagecreatefromgd2($uri))) {
         $e = new ImagingException('Cannot read image');
         xp::gc(__FILE__);
         throw $e;
     }
     return $r;
 }
开发者ID:Gamepay,项目名称:xp-framework,代码行数:16,代码来源:GD2StreamReader.class.php

示例3: createThumb

function createThumb($filename, $fondo, $w, $h)
{
    error_reporting(E_ERROR);
    if (imagecreatefromjpeg($filename) || imagecreatefrompng($filename) || imagecreatefromgif($filename) || imagecreatefromgd2($filename)) {
        return $this->jpegThumb($filename, $fondo, $w, $h);
    } else {
        debug("IMAGE NOT SUPPORTED " . mime_content_type($filename), "white");
        return false;
    }
}
开发者ID:BackupTheBerlios,项目名称:ascore,代码行数:10,代码来源:foto.php

示例4: testSaveToFile

 function testSaveToFile()
 {
     $handle = imagecreatefromgif(IMG_PATH . '100x100-color-hole.gif');
     $this->mapper->save($handle, IMG_PATH . 'temp/test.gd2');
     $this->assertTrue(filesize(IMG_PATH . 'temp/test.gd2') > 0);
     imagedestroy($handle);
     // file is a valid image
     $handle = imagecreatefromgd2(IMG_PATH . 'temp/test.gd2');
     $this->assertTrue(WideImage::isValidImageHandle($handle));
     imagedestroy($handle);
 }
开发者ID:NaszvadiG,项目名称:DivaSul,代码行数:11,代码来源:GD2Test.php

示例5: _from

 /**
  * 根据原始文件的扩展名,返回从原始文件创建的一个画布
  * @return resource 返回从原始文件取得的一个图像
  */
 private function _from()
 {
     switch ($this->src_img_ext) {
         case "gd2":
             return imagecreatefromgd2($this->src_img);
         case "gd":
             return imagecreatefromgd($this->src_img);
         case "gif":
             return imagecreatefromgif($this->src_img);
         case "jpeg":
             return imagecreatefromjpeg($this->src_img);
         case "jpg":
             return imagecreatefromjpeg($this->src_img);
         case "png":
             return imagecreatefrompng($this->src_img);
         default:
             return FALSE;
     }
 }
开发者ID:gtyd,项目名称:jira,代码行数:23,代码来源:File.php

示例6: open_image

function open_image($file)
{
    $im = @imagecreatefromjpeg($file);
    if ($im !== false) {
        return $im;
    }
    $im = @imagecreatefromgif($file);
    if ($im !== false) {
        return $im;
    }
    $im = @imagecreatefrompng($file);
    if ($im !== false) {
        return $im;
    }
    $im = @imagecreatefromgd($file);
    if ($im !== false) {
        return $im;
    }
    $im = @imagecreatefromgd2($file);
    if ($im !== false) {
        return $im;
    }
    $im = @imagecreatefromwbmp($file);
    if ($im !== false) {
        return $im;
    }
    $im = @imagecreatefromxbm($file);
    if ($im !== false) {
        return $im;
    }
    $im = @imagecreatefromxpm($file);
    if ($im !== false) {
        return $im;
    }
    $im = @imagecreatefromstring(file_get_contents($file));
    if ($im !== false) {
        return $im;
    }
    return false;
}
开发者ID:madr,项目名称:urban-octo-rotary-phone,代码行数:40,代码来源:common.php

示例7: registerBuiltInParsers

 public static function registerBuiltInParsers()
 {
     static $registered = false;
     if ($registered) {
         return;
     }
     $registered = true;
     $parsers = ["image/gif" => function ($_filename) {
         return @imagecreatefromgif($_filename);
     }, "image/png" => function ($_filename) {
         return @imagecreatefrompng($_filename);
     }, "image/bmp" => function ($_filename) {
         return @ExtLib::imageCreateFromBmp($_filename);
     }, "image/jpeg" => function ($_filename) {
         return @imagecreatefromjpeg($_filename);
     }, "application/octet-stream" => function ($_filename) {
         return @imagecreatefromgd2($_filename);
     }];
     foreach ($parsers as $type => $parser) {
         static::registerParser($type, $parser);
     }
 }
开发者ID:keradus,项目名称:graphics,代码行数:22,代码来源:ImageFileLoader.php

示例8: loadGD

 /**
  * load gd resource from dest file
  * @param resource $fsrc the gd2 file source
  * @return boolean true on success false otherwise
  */
 public static function loadGD($fsrc, $fileName)
 {
     if (@file_exists($fsrc)) {
         $fsrc = $fsrc . $fileName . ".gd2";
         $result = @imagecreatefromgd2($fsrc);
         if (!$result) {
             self::logger("loadGD", "Unable To Load GD Resource Into ({$dest})");
         }
         return $result;
     }
     self::logger("loadGD", "({$fsrc}) Is Not Exist");
     return false;
 }
开发者ID:OccultScripto,项目名称:rogentos-www,代码行数:18,代码来源:tulipIP.php

示例9: loadGD2

 public function loadGD2($sFile)
 {
     $this->rImage = imagecreatefromgd2($sFile);
 }
开发者ID:vulcandth,项目名称:steamprofile,代码行数:4,代码来源:GDImage.php

示例10: open

 public static function open($file, $type)
 {
     // @rule: Test for JPG image extensions
     if (function_exists('imagecreatefromjpeg') && ($type == 'image/jpg' || $type == 'image/jpeg' || $type == 'image/pjpeg')) {
         $im = @imagecreatefromjpeg($file);
         if ($im !== false) {
             return $im;
         }
     }
     // @rule: Test for png image extensions
     if (function_exists('imagecreatefrompng') && ($type == 'image/png' || $type == 'image/x-png')) {
         $im = @imagecreatefrompng($file);
         if ($im !== false) {
             return $im;
         }
     }
     // @rule: Test for png image extensions
     if (function_exists('imagecreatefromgif') && $type == 'image/gif') {
         $im = @imagecreatefromgif($file);
         if ($im !== false) {
             return $im;
         }
     }
     if (function_exists('imagecreatefromgd')) {
         # GD File:
         $im = @imagecreatefromgd($file);
         if ($im !== false) {
             return true;
         }
     }
     if (function_exists('imagecreatefromgd2')) {
         # GD2 File:
         $im = @imagecreatefromgd2($file);
         if ($im !== false) {
             return true;
         }
     }
     if (function_exists('imagecreatefromwbmp')) {
         # WBMP:
         $im = @imagecreatefromwbmp($file);
         if ($im !== false) {
             return true;
         }
     }
     if (function_exists('imagecreatefromxbm')) {
         # XBM:
         $im = @imagecreatefromxbm($file);
         if ($im !== false) {
             return true;
         }
     }
     if (function_exists('imagecreatefromxpm')) {
         # XPM:
         $im = @imagecreatefromxpm($file);
         if ($im !== false) {
             return true;
         }
     }
     // If all failed, this photo is invalid
     return false;
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:61,代码来源:image.php

示例11: mysqltest

 //print "suffix: '$suffix'<br />";
 mysqltest();
 if ($suffix == "jpeg" || $suffix == "jpg" || $suffix == "jif" || $suffix == "jpe") {
     $im = @imagecreatefromjpeg($localtempfile);
 } else {
     if ($suffix == "png") {
         $im = @imagecreatefrompng($localtempfile);
     } else {
         if ($suffix == "gif") {
             $im = @imagecreatefromgif($localtempfile);
         } else {
             if ($suffix == "gd") {
                 $im = @imagecreatefromgd($localtempfile);
             } else {
                 if ($suffix == "gd2") {
                     $im = @imagecreatefromgd2($localtempfile);
                 } else {
                     if ($suffix == "wbmp") {
                         $im = @imagecreatefromwbmp($localtempfile);
                     }
                 }
             }
         }
     }
 }
 mysqltest();
 if (!$im) {
     $output = "." . $thumb_folder . "/dummy.png";
     // create name for thumbnail
     $im = @ImageCreate(150, 50) or die('');
     $background_color = ImageColorAllocate($im, 189, 228, 212);
开发者ID:hackersforcharity,项目名称:rachelpiOS,代码行数:31,代码来源:index_media.php

示例12: _crear

 function _crear($path, $medida = 127, $formato = 'jpg', $nombre, $vert = false)
 {
     $nom = basename($path, '.' . $formato);
     $gene = $nombre . '_generatriz.gd2';
     $dir = dirname($path) . '/' . $gene;
     if (file_exists($dir)) {
         //si existe la generatriz
         $image = imagecreatefromgd2($dir);
         $oancho = imagesx($image);
         $oalto = imagesy($image);
         if ($vert) {
             $ancho = $medida;
             $alto = round($ancho * $oalto / $oancho);
         } else {
             $alto = $medida;
             $ancho = round($alto * $oancho / $oalto);
         }
         $im = imagecreatetruecolor($ancho, $alto);
         imagecopyresampled($im, $image, 0, 0, 0, 0, $ancho, $alto, $oancho, $oalto);
     } else {
         //si no existe la generatriz
         $rif = $this->datasis->traevalor('RIF');
         $titu = empty($rif) ? 'Logotipo' : $rif;
         if ($vert) {
             $ancho = $medida;
             $alto = 80;
         } else {
             $alto = $medida;
             $ancho = 127;
         }
         $im = imagecreate($ancho, $alto);
         $white = imagecolorallocate($im, 255, 255, 255);
         $black = imagecolorallocate($im, 0, 0, 0);
         $font_ancho = imagefontwidth(5);
         // para calcular el grosor de la fuente
         $string_alto = imagefontheight(5);
         $string_ancho = $font_ancho * strlen($titu);
         //imagefill($im, 0, 0, $white);      //Se crea una imagen con un unico color
         $x = floor(($ancho - $string_ancho) / 2);
         $y = floor(($alto - $string_alto) / 2);
         imagestring($im, 5, $x, $y, $titu, $black);
         //El 5 viene a ser el tamaño de la letra 1-5
         imageline($im, $x, $y, $x + $string_ancho, $y, $black);
         imageline($im, $x, $y + $string_alto, $x + $string_ancho, $y + $string_alto, $black);
     }
     if (!$this->write) {
         $path = null;
     }
     switch ($formato) {
         case 'jpg':
             imagejpeg($im, $path);
             break;
         case 'gif':
             imagegif($im, $path);
             break;
         case 'png':
             imagepng($im, $path);
             break;
     }
     imagedestroy($im);
 }
开发者ID:codethics,项目名称:proteoerp,代码行数:61,代码来源:logo.php

示例13: load

 private function load($path, $type)
 {
     $image = null;
     // jpeg
     if (function_exists('imagecreatefromjpeg') && ($type == 'image/jpg' || $type == 'image/jpeg' || $type == 'image/pjpeg')) {
         $image = @imagecreatefromjpeg($path);
         if ($image !== false) {
             return $image;
         }
     }
     // png
     if (function_exists('imagecreatefrompng') && ($type == 'image/png' || $type == 'image/x-png')) {
         $image = @imagecreatefrompng($path);
         if ($image !== false) {
             return $image;
         }
     }
     // gif
     if (function_exists('imagecreatefromgif') && $type == 'image/gif') {
         $image = @imagecreatefromgif($path);
         if ($image !== false) {
             return $image;
         }
     }
     // gd
     if (function_exists('imagecreatefromgd')) {
         $image = imagecreatefromgd($path);
         if ($image !== false) {
             return $image;
         }
     }
     // gd2
     if (function_exists('imagecreatefromgd2')) {
         $image = @imagecreatefromgd2($path);
         if ($image !== false) {
             return $image;
         }
     }
     // bmp
     if (function_exists('imagecreatefromwbmp')) {
         $image = @imagecreatefromwbmp($path);
         if ($image !== false) {
             return $image;
         }
     }
     return $image;
 }
开发者ID:3116246,项目名称:haolinju,代码行数:47,代码来源:Gd.php

示例14: dirname

<?php

$cwd = dirname(__FILE__);
echo "JPEG to GD1 conversion: ";
echo imagegd(imagecreatefromjpeg($cwd . "/conv_test.jpeg"), $cwd . "/test.gd1") ? 'ok' : 'failed';
echo "\n";
echo "JPEG to GD2 conversion: ";
echo imagegd2(imagecreatefromjpeg($cwd . "/conv_test.jpeg"), $cwd . "/test.gd2") ? 'ok' : 'failed';
echo "\n";
echo "GD1 to JPEG conversion: ";
echo imagejpeg(imagecreatefromgd($cwd . "/test.gd1"), $cwd . "/test_gd1.jpeg") ? 'ok' : 'failed';
echo "\n";
echo "GD2 to JPEG conversion: ";
echo imagejpeg(imagecreatefromgd2($cwd . "/test.gd2"), $cwd . "/test_gd2.jpeg") ? 'ok' : 'failed';
echo "\n";
@unlink($cwd . "/test.gd1");
@unlink($cwd . "/test.gd2");
@unlink($cwd . "/test_gd1.jpeg");
@unlink($cwd . "/test_gd2.jpeg");
开发者ID:badlamer,项目名称:hhvm,代码行数:19,代码来源:jpg2gd.php

示例15: copyOrig

 /**
  * Make the $this->hdlWork to be an exact copy
  * of $this->hdlOrig resource
  *
  * @return object $this
  */
 protected function copyOrig()
 {
     d('start cloning orig resource');
     $tmpfname = \tempnam($this->Ini->TEMP_DIR, "imgclone");
     d('$tmpfname: ' . $tmpfname);
     \imagegd2($this->hdlOrig, $tmpfname);
     $this->hdlWork = \imagecreatefromgd2($tmpfname);
     @\unlink($tmpfname);
     return $this;
 }
开发者ID:netconstructor,项目名称:LampCMS,代码行数:16,代码来源:EditorGD.php


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