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


PHP Image::CreateFromString方法代码示例

本文整理汇总了PHP中Image::CreateFromString方法的典型用法代码示例。如果您正苦于以下问题:PHP Image::CreateFromString方法的具体用法?PHP Image::CreateFromString怎么用?PHP Image::CreateFromString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Image的用法示例。


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

示例1: GetImgByIdx

 function GetImgByIdx($aIdx)
 {
     if (array_key_exists($aIdx, $this->iFlagData)) {
         $d = $this->iFlagData[$aIdx][1];
         return Image::CreateFromString($d);
     } else {
         JpGraphError::RaiseL(5002, $aIdx);
     }
 }
开发者ID:natanoj,项目名称:nuBuilderPro,代码行数:9,代码来源:jpgraph_flags.php

示例2: GetImgByIdx

 function GetImgByIdx($aIdx)
 {
     if (array_key_exists($aIdx, $this->iFlagData)) {
         $d = $this->iFlagData[$aIdx][1];
         return Image::CreateFromString($d);
     } else {
         JpGraphError::Raise("Flag index \" {$aIdx}\" does not exist.");
     }
 }
开发者ID:GeorgeAlexandre,项目名称:yipservicedesk,代码行数:9,代码来源:jpgraph_flags.php

示例3: GetImg

 function GetImg($aMark, $aIdx)
 {
     $n = $this->an[$aMark];
     if (is_string($aIdx)) {
         if (!in_array($aIdx, $this->colors)) {
             JpGraphError::RaiseL(23001, $this->name, $aIdx);
         }
         $idx = $this->index[$aIdx];
     } elseif (!is_integer($aIdx) || is_integer($aIdx) && $aIdx > $this->maxidx) {
         JpGraphError::RaiseL(23002, $this->name);
     } else {
         $idx = $aIdx;
     }
     return Image::CreateFromString(base64_decode($this->{$n}[$idx][1]));
 }
开发者ID:natanoj,项目名称:nuBuilderPro,代码行数:15,代码来源:jpgraph_plotmark.inc.php

示例4: Raise

 function Raise($aMsg, $aHalt = true)
 {
     $img_iconerror = 'iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAMAAAC7IEhfAAAAaV' . 'BMVEX//////2Xy8mLl5V/Z2VvMzFi/v1WyslKlpU+ZmUyMjEh/' . 'f0VyckJlZT9YWDxMTDjAwMDy8sLl5bnY2K/MzKW/v5yyspKlpY' . 'iYmH+MjHY/PzV/f2xycmJlZVlZWU9MTEXY2Ms/PzwyMjLFTjea' . 'AAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACx' . 'IAAAsSAdLdfvwAAAAHdElNRQfTBgISOCqusfs5AAABLUlEQVR4' . '2tWV3XKCMBBGWfkranCIVClKLd/7P2Q3QsgCxjDTq+6FE2cPH+' . 'xJ0Ogn2lQbsT+Wrs+buAZAV4W5T6Bs0YXBBwpKgEuIu+JERAX6' . 'wM2rHjmDdEITmsQEEmWADgZm6rAjhXsoMGY9B/NZBwJzBvn+e3' . 'wHntCAJdGu9SviwIwoZVDxPB9+Rc0TSEbQr0j3SA1gwdSn6Db0' . '6Tm1KfV6yzWGQO7zdpvyKLKBDmRFjzeB3LYgK7r6A/noDAfjtS' . 'IXaIzbJSv6WgUebTMV4EoRB8a2mQiQjgtF91HdKDKZ1gtFtQjk' . 'YcWaR5OKOhkYt+ZsTFdJRfPAApOpQYJTNHvCRSJR6SJngQadfc' . 'vd69OLMddVOPCGVnmrFD8bVYd3JXfxXPtLR/+mtv59/ALWiiMx' . 'qL72fwAAAABJRU5ErkJggg==';
     $supported = imagetypes();
     if (ob_get_length() || headers_sent() || !($supported & IMG_PNG)) {
         // Special case for headers already sent or that the installation doesn't support
         // the PNG format (which the error icon is encoded in).
         // Dont return an image since it can't be displayed
         die("<b>JpGraph Error:</b> " . $aMsg);
     }
     $aMsg = wordwrap($aMsg, 55);
     $lines = substr_count($aMsg, "\n");
     // Create the error icon GD
     $erricon = Image::CreateFromString(base64_decode($img_iconerror));
     // Create an image that contains the error text.
     $w = 400;
     $h = 100 + 15 * max(0, $lines - 3);
     /*
     $h=100;
     if( strlen($aMsg) > 60 ) 
         $h = 150;
     */
     $img = new Image($w, $h);
     // Drop shadow
     $img->SetColor("gray");
     $img->FilledRectangle(5, 5, $w - 1, $h - 1, 10);
     $img->SetColor("gray:0.7");
     $img->FilledRectangle(5, 5, $w - 3, $h - 3, 10);
     // Window background
     $img->SetColor("lightblue");
     $img->FilledRectangle(1, 1, $w - 5, $h - 5);
     $img->CopyCanvasH($img->img, $erricon, 5, 30, 0, 0, 40, 40);
     // Window border
     $img->SetColor("black");
     $img->Rectangle(1, 1, $w - 5, $h - 5);
     $img->Rectangle(0, 0, $w - 4, $h - 4);
     // Window top row
     $img->SetColor("darkred");
     for ($y = 3; $y < 18; $y += 2) {
         $img->Line(1, $y, $w - 6, $y);
     }
     // "White shadow"
     $img->SetColor("white");
     // Left window edge
     $img->Line(2, 2, 2, $h - 5);
     $img->Line(2, 2, $w - 6, 2);
     // "Gray button shadow"
     $img->SetColor("darkgray");
     // Gray window shadow
     $img->Line(2, $h - 6, $w - 5, $h - 6);
     $img->Line(3, $h - 7, $w - 5, $h - 7);
     // Window title
     $m = floor($w / 2 - 5);
     $l = 100;
     $img->SetColor("lightgray:1.3");
     $img->FilledRectangle($m - $l, 2, $m + $l, 16);
     // Stroke text
     $img->SetColor("darkred");
     $img->SetFont(FF_FONT2, FS_BOLD);
     $img->StrokeText($m - 50, 15, "JpGraph Error");
     $img->SetColor("black");
     $img->SetFont(FF_FONT1, FS_NORMAL);
     $txt = new Text($aMsg, 52, 25);
     $txt->Align("left", "top");
     $txt->Stroke($img);
     $img->Headers();
     $img->Stream();
     die;
 }
开发者ID:hostellerie,项目名称:nexpro,代码行数:69,代码来源:jpgraph.php

示例5: LoadBkgImage

 static function LoadBkgImage($aImgFormat = '', $aFile = '', $aImgStr = '')
 {
     if ($aImgStr != '') {
         return Image::CreateFromString($aImgStr);
     }
     // Remove case sensitivity and setup appropriate function to create image
     // Get file extension. This should be the LAST '.' separated part of the filename
     $e = explode('.', $aFile);
     $ext = strtolower($e[count($e) - 1]);
     if ($ext == "jpeg") {
         $ext = "jpg";
     }
     if (trim($ext) == '') {
         $ext = 'png';
         // Assume PNG if no extension specified
     }
     if ($aImgFormat == '') {
         $imgtag = $ext;
     } else {
         $imgtag = $aImgFormat;
     }
     $supported = imagetypes();
     if ($ext == 'jpg' && !($supported & IMG_JPG) || $ext == 'gif' && !($supported & IMG_GIF) || $ext == 'png' && !($supported & IMG_PNG) || $ext == 'bmp' && !($supported & IMG_WBMP) || $ext == 'xpm' && !($supported & IMG_XPM)) {
         JpGraphError::RaiseL(25037, $aFile);
         //('The image format of your background image ('.$aFile.') is not supported in your system configuration. ');
     }
     if ($imgtag == "jpg" || $imgtag == "jpeg") {
         $f = "imagecreatefromjpeg";
         $imgtag = "jpg";
     } else {
         $f = "imagecreatefrom" . $imgtag;
     }
     // Compare specified image type and file extension
     if ($imgtag != $ext) {
         //$t = "Background image seems to be of different type (has different file extension) than specified imagetype. Specified: '".$aImgFormat."'File: '".$aFile."'";
         JpGraphError::RaiseL(25038, $aImgFormat, $aFile);
     }
     $img = @$f($aFile);
     if (!$img) {
         JpGraphError::RaiseL(25039, $aFile);
         //(" Can't read background image: '".$aFile."'");
     }
     return $img;
 }
开发者ID:nbgmaster,项目名称:happify,代码行数:44,代码来源:jpgraph.php

示例6: GetImg

 function GetImg($aIdx)
 {
     if ($aIdx < 0 || $aIdx >= $this->iLen) {
         JpGraphError::RaiseL(6010, $aIdx);
         //('Illegal icon index for Gantt builtin icon ['.$aIdx.']');
     }
     return Image::CreateFromString(base64_decode($this->iBuiltinIcon[$aIdx][1]));
 }
开发者ID:valerio-bozzolan,项目名称:openparlamento,代码行数:8,代码来源:jpgraph_gantt.php

示例7: _Stroke

 function _Stroke($aImg, $x = null, $y = null, $aReturnWidthHeight = false)
 {
     if ($this->iFile != '' && $this->iCountryFlag != '') {
         JpGraphError::RaiseL(8003);
         //('It is not possible to specify both an image file and a country flag for the same icon.');
     }
     if ($this->iFile != '') {
         $gdimg = Graph::LoadBkgImage('', $this->iFile);
     } elseif ($this->iImgString != '') {
         $gdimg = Image::CreateFromString($this->iImgString);
     } else {
         if (!class_exists('FlagImages', false)) {
             JpGraphError::RaiseL(8004);
             //('In order to use Country flags as icons you must include the "jpgraph_flags.php" file.');
         }
         $fobj = new FlagImages($this->iCountryStdSize);
         $dummy = '';
         $gdimg = $fobj->GetImgByName($this->iCountryFlag, $dummy);
     }
     $iconw = imagesx($gdimg);
     $iconh = imagesy($gdimg);
     if ($aReturnWidthHeight) {
         return array(round($iconw * $this->iScale), round($iconh * $this->iScale));
     }
     if ($x !== null && $y !== null) {
         $this->iX = $x;
         $this->iY = $y;
     }
     if ($this->iX >= 0 && $this->iX <= 1.0) {
         $w = imagesx($aImg->img);
         $this->iX = round($w * $this->iX);
     }
     if ($this->iY >= 0 && $this->iY <= 1.0) {
         $h = imagesy($aImg->img);
         $this->iY = round($h * $this->iY);
     }
     if ($this->iHorAnchor == 'center') {
         $this->iX -= round($iconw * $this->iScale / 2);
     }
     if ($this->iHorAnchor == 'right') {
         $this->iX -= round($iconw * $this->iScale);
     }
     if ($this->iVertAnchor == 'center') {
         $this->iY -= round($iconh * $this->iScale / 2);
     }
     if ($this->iVertAnchor == 'bottom') {
         $this->iY -= round($iconh * $this->iScale);
     }
     $aImg->CopyMerge($gdimg, $this->iX, $this->iY, 0, 0, round($iconw * $this->iScale), round($iconh * $this->iScale), $iconw, $iconh, $this->iMix);
 }
开发者ID:nbgmaster,项目名称:happify,代码行数:50,代码来源:jpgraph_iconplot.php

示例8: Raise

 function Raise($aMsg, $aHalt = true)
 {
     $img_iconerror = 'iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAMAAAC7IEhfAAAAaV' . 'BMVEX//////2Xy8mLl5V/Z2VvMzFi/v1WyslKlpU+ZmUyMjEh/' . 'f0VyckJlZT9YWDxMTDjAwMDy8sLl5bnY2K/MzKW/v5yyspKlpY' . 'iYmH+MjHY/PzV/f2xycmJlZVlZWU9MTEXY2Ms/PzwyMjLFTjea' . 'AAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACx' . 'IAAAsSAdLdfvwAAAAHdElNRQfTBgISOCqusfs5AAABLUlEQVR4' . '2tWV3XKCMBBGWfkranCIVClKLd/7P2Q3QsgCxjDTq+6FE2cPH+' . 'xJ0Ogn2lQbsT+Wrs+buAZAV4W5T6Bs0YXBBwpKgEuIu+JERAX6' . 'wM2rHjmDdEITmsQEEmWADgZm6rAjhXsoMGY9B/NZBwJzBvn+e3' . 'wHntCAJdGu9SviwIwoZVDxPB9+Rc0TSEbQr0j3SA1gwdSn6Db0' . '6Tm1KfV6yzWGQO7zdpvyKLKBDmRFjzeB3LYgK7r6A/noDAfjtS' . 'IXaIzbJSv6WgUebTMV4EoRB8a2mQiQjgtF91HdKDKZ1gtFtQjk' . 'YcWaR5OKOhkYt+ZsTFdJRfPAApOpQYJTNHvCRSJR6SJngQadfc' . 'vd69OLMddVOPCGVnmrFD8bVYd3JXfxXPtLR/+mtv59/ALWiiMx' . 'qL72fwAAAABJRU5ErkJggg==';
     if (function_exists("imagetypes")) {
         $supported = imagetypes();
     } else {
         $supported = 0;
     }
     if (!function_exists('imagecreatefromstring')) {
         $supported = 0;
     }
     if (ob_get_length() || headers_sent() || !($supported & IMG_PNG)) {
         die($this->iTitle . ' ' . $aMsg);
     }
     $aMsg = wordwrap($aMsg, 55);
     $lines = substr_count($aMsg, "\n");
     $erricon = Image::CreateFromString(base64_decode($img_iconerror));
     $w = 400;
     $h = 100 + 15 * max(0, $lines - 3);
     $img = new Image($w, $h);
     $img->SetColor("gray");
     $img->FilledRectangle(5, 5, $w - 1, $h - 1, 10);
     $img->SetColor("gray:0.7");
     $img->FilledRectangle(5, 5, $w - 3, $h - 3, 10);
     $img->SetColor("lightblue");
     $img->FilledRectangle(1, 1, $w - 5, $h - 5);
     $img->CopyCanvasH($img->img, $erricon, 5, 30, 0, 0, 40, 40);
     $img->SetColor("black");
     $img->Rectangle(1, 1, $w - 5, $h - 5);
     $img->Rectangle(0, 0, $w - 4, $h - 4);
     $img->SetColor("darkred");
     for ($y = 3; $y < 18; $y += 2) {
         $img->Line(1, $y, $w - 6, $y);
     }
     $img->SetColor("white");
     $img->Line(2, 2, 2, $h - 5);
     $img->Line(2, 2, $w - 6, 2);
     $img->SetColor("darkgray");
     $img->Line(2, $h - 6, $w - 5, $h - 6);
     $img->Line(3, $h - 7, $w - 5, $h - 7);
     $m = floor($w / 2 - 5);
     $l = 100;
     $img->SetColor("lightgray:1.3");
     $img->FilledRectangle($m - $l, 2, $m + $l, 16);
     $img->SetColor("darkred");
     $img->SetFont(FF_FONT2, FS_BOLD);
     $img->StrokeText($m - 50, 15, $this->iTitle);
     $img->SetColor("black");
     $img->SetFont(FF_FONT1, FS_NORMAL);
     $txt = new Text($aMsg, 52, 25);
     $txt->Align("left", "top");
     $txt->Stroke($img);
     if ($this->iDest) {
         $img->Stream($this->iDest);
     } else {
         $img->Headers();
         $img->Stream();
     }
     if ($aHalt) {
         die;
     }
 }
开发者ID:natanoj,项目名称:nuBuilderPro,代码行数:62,代码来源:jpgraph_errhandler.inc.php

示例9: LoadBkgImage

 function LoadBkgImage($aImgFormat = '', $aFile = '', $aImgStr = '')
 {
     if ($aImgStr != '') {
         return Image::CreateFromString($aImgStr);
     }
     $e = explode('.', $aFile);
     $ext = strtolower($e[count($e) - 1]);
     if ($ext == "jpeg") {
         $ext = "jpg";
     }
     if (trim($ext) == '') {
         $ext = 'png';
     }
     if ($aImgFormat == '') {
         $imgtag = $ext;
     } else {
         $imgtag = $aImgFormat;
     }
     $supported = imagetypes();
     if ($ext == 'jpg' && !($supported & IMG_JPG) || $ext == 'gif' && !($supported & IMG_GIF) || $ext == 'png' && !($supported & IMG_PNG) || $ext == 'bmp' && !($supported & IMG_WBMP) || $ext == 'xpm' && !($supported & IMG_XPM)) {
         JpGraphError::RaiseL(25037, $aFile);
     }
     if ($imgtag == "jpg" || $imgtag == "jpeg") {
         $f = "imagecreatefromjpeg";
         $imgtag = "jpg";
     } else {
         $f = "imagecreatefrom" . $imgtag;
     }
     if ($imgtag != $ext) {
         JpGraphError::RaiseL(25038, $aImgFormat, $aFile);
     }
     $img = @$f($aFile);
     if (!$img) {
         JpGraphError::RaiseL(25039, $aFile);
     }
     return $img;
 }
开发者ID:natanoj,项目名称:nuBuilderPro,代码行数:37,代码来源:jpgraph.php

示例10: _Stroke

 function _Stroke(&$aImg, $x = null, $y = null, $aReturnWidthHeight = false)
 {
     if ($this->iFile != '' && $this->iCountryFlag != '') {
         JpGraphError::RaiseL(8003);
     }
     if ($this->iFile != '') {
         $gdimg = Graph::LoadBkgImage('', $this->iFile);
     } elseif ($this->iImgString != '') {
         $gdimg = Image::CreateFromString($this->iImgString);
     } else {
         if (!class_exists('FlagImages')) {
             JpGraphError::RaiseL(8004);
         }
         $fobj = new FlagImages($this->iCountryStdSize);
         $dummy = '';
         $gdimg = $fobj->GetImgByName($this->iCountryFlag, $dummy);
     }
     $iconw = imagesx($gdimg);
     $iconh = imagesy($gdimg);
     if ($aReturnWidthHeight) {
         return array(round($iconw * $this->iScale), round($iconh * $this->iScale));
     }
     if ($x !== null && $y !== null) {
         $this->iX = $x;
         $this->iY = $y;
     }
     if ($this->iX >= 0 && $this->iX <= 1.0) {
         $w = imagesx($aImg->img);
         $this->iX = round($w * $this->iX);
     }
     if ($this->iY >= 0 && $this->iY <= 1.0) {
         $h = imagesy($aImg->img);
         $this->iY = round($h * $this->iY);
     }
     if ($this->iHorAnchor == 'center') {
         $this->iX -= round($iconw * $this->iScale / 2);
     }
     if ($this->iHorAnchor == 'right') {
         $this->iX -= round($iconw * $this->iScale);
     }
     if ($this->iVertAnchor == 'center') {
         $this->iY -= round($iconh * $this->iScale / 2);
     }
     if ($this->iVertAnchor == 'bottom') {
         $this->iY -= round($iconh * $this->iScale);
     }
     $aImg->CopyMerge($gdimg, $this->iX, $this->iY, 0, 0, round($iconw * $this->iScale), round($iconh * $this->iScale), $iconw, $iconh, $this->iMix);
 }
开发者ID:natanoj,项目名称:nuBuilderPro,代码行数:48,代码来源:jpgraph_iconplot.php


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