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


PHP GenImgName函数代码示例

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


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

示例1: isImgCached

function isImgCached($file)
{
    if (!USE_CACHE) {
        return false;
    }
    if ($file == 'auto') {
        $file = GenImgName();
        // imported from jpgraph.php
    }
    $filename = catfile(CACHE_DIR, $file);
    if (file_exists($filename)) {
        if (CACHE_TIMEOUT == 0) {
            return true;
        }
        $diff = time() - filemtime($filename);
        return $diff < CACHE_TIMEOUT * 60;
    }
    return false;
}
开发者ID:Nerus87,项目名称:PsychoStats,代码行数:19,代码来源:imgcommon.php

示例2: PutAndStream

 function PutAndStream(&$aImage, $aCacheFileName, $aInline, $aStrokeFileName)
 {
     // Some debugging code to brand the image with numbe of colors
     // used
     global $gJpgBrandTiming;
     if ($gJpgBrandTiming) {
         global $tim;
         $t = $tim->Pop() / 1000.0;
         $c = $aImage->SetColor("black");
         $t = sprintf(BRAND_TIME_FORMAT, round($t, 3));
         imagestring($this->img->img, 2, 5, $this->img->height - 20, $t, $c);
     }
     // Check if we should stroke the image to an arbitrary file
     if (_FORCE_IMGTOFILE) {
         $aStrokeFileName = _FORCE_IMGDIR . GenImgName();
     }
     if ($aStrokeFileName != "") {
         if ($aStrokeFileName == "auto") {
             $aStrokeFileName = GenImgName();
         }
         if (file_exists($aStrokeFileName)) {
             // Delete the old file
             if (!@unlink($aStrokeFileName)) {
                 JpGraphError::Raise(" Can't delete cached image {$aStrokeFileName}. Permission problem?");
             }
         }
         $aImage->Stream($aStrokeFileName);
         return;
     }
     if ($aCacheFileName != "" && USE_CACHE) {
         $aCacheFileName = $this->cache_dir . $aCacheFileName;
         if (file_exists($aCacheFileName)) {
             if (!$aInline) {
                 // If we are generating image off-line (just writing to the cache)
                 // and the file exists and is still valid (no timeout)
                 // then do nothing, just return.
                 $diff = time() - filemtime($aCacheFileName);
                 if ($diff < 0) {
                     JpGraphError::Raise(" Cached imagefile ({$aCacheFileName}) has file date in the future!!");
                 }
                 if ($this->timeout > 0 && $diff <= $this->timeout * 60) {
                     return;
                 }
             }
             if (!@unlink($aCacheFileName)) {
                 JpGraphError::Raise(" Can't delete cached image {$aStrokeFileName}. Permission problem?");
             }
             $aImage->Stream($aCacheFileName);
         } else {
             $this->MakeDirs(dirname($aCacheFileName));
             if (!is_writeable(dirname($aCacheFileName))) {
                 JpGraphError::Raise('PHP has not enough permissions to write to the cache file ' . $aCacheFileName . '. Please make sure that the user running PHP has write permission for this file if you wan to use the cache system with JpGraph.');
             }
             $aImage->Stream($aCacheFileName);
         }
         $res = true;
         // Set group to specified
         if (CACHE_FILE_GROUP != "") {
             $res = @chgrp($aCacheFileName, CACHE_FILE_GROUP);
         }
         if (CACHE_FILE_MOD != "") {
             $res = @chmod($aCacheFileName, CACHE_FILE_MOD);
         }
         if (!$res) {
             JpGraphError::Raise(" Can't set permission for cached image {$aStrokeFileName}. Permission problem?");
         }
         $aImage->Destroy();
         if ($aInline) {
             if ($fh = @fopen($aCacheFileName, "rb")) {
                 $this->img->Headers();
                 fpassthru($fh);
                 return;
             } else {
                 JpGraphError::Raise(" Cant open file from cache [{$aFile}]");
             }
         }
     } elseif ($aInline) {
         $this->img->Headers();
         $aImage->Stream();
         return;
     }
 }
开发者ID:hostellerie,项目名称:nexpro,代码行数:82,代码来源:jpgraph.php

示例3: __construct

 function __construct($aWidth = 300, $aHeight = 200, $aCachedName = '', $aTimeout = 0, $aInline = true)
 {
     if (!is_numeric($aWidth) || !is_numeric($aHeight)) {
         JpGraphError::RaiseL(25008);
         //('Image width/height argument in Graph::Graph() must be numeric');
     }
     // Initialize frame and margin
     $this->InitializeFrameAndMargin();
     // Automatically generate the image file name based on the name of the script that
     // generates the graph
     if ($aCachedName == 'auto') {
         $aCachedName = GenImgName();
     }
     // Should the image be streamed back to the browser or only to the cache?
     $this->inline = $aInline;
     $this->img = new RotImage($aWidth, $aHeight);
     $this->cache = new ImgStreamCache();
     // Window doesn't like '?' in the file name so replace it with an '_'
     $aCachedName = str_replace("?", "_", $aCachedName);
     $this->SetupCache($aCachedName, $aTimeout);
     $this->title = new Text();
     $this->title->ParagraphAlign('center');
     $this->title->SetFont(FF_DEFAULT, FS_NORMAL);
     //FF_FONT2, FS_BOLD
     $this->title->SetMargin(5);
     $this->title->SetAlign('center');
     $this->subtitle = new Text();
     $this->subtitle->ParagraphAlign('center');
     $this->subtitle->SetMargin(3);
     $this->subtitle->SetAlign('center');
     $this->subsubtitle = new Text();
     $this->subsubtitle->ParagraphAlign('center');
     $this->subsubtitle->SetMargin(3);
     $this->subsubtitle->SetAlign('center');
     $this->legend = new Legend();
     $this->footer = new Footer();
     // If the cached version exist just read it directly from the
     // cache, stream it back to browser and exit
     if ($aCachedName != '' && READ_CACHE && $aInline) {
         if ($this->cache->GetAndStream($this->img, $aCachedName)) {
             exit;
         }
     }
     $this->SetTickDensity();
     // Normal density
     $this->tabtitle = new GraphTabTitle();
     if (!$this->isRunningClear) {
         $this->inputValues = array();
         $this->inputValues['aWidth'] = $aWidth;
         $this->inputValues['aHeight'] = $aHeight;
         $this->inputValues['aCachedName'] = $aCachedName;
         $this->inputValues['aTimeout'] = $aTimeout;
         $this->inputValues['aInline'] = $aInline;
         $theme_class = DEFAULT_THEME_CLASS;
         if (class_exists($theme_class)) {
             $this->graph_theme = new $theme_class();
         }
     }
 }
开发者ID:nbgmaster,项目名称:happify,代码行数:59,代码来源:jpgraph.php

示例4: PutAndStream

 function PutAndStream($aImage, $aCacheFileName, $aInline, $aStrokeFileName)
 {
     // Check if we should always stroke the image to a file
     if (_FORCE_IMGTOFILE) {
         $aStrokeFileName = _FORCE_IMGDIR . GenImgName();
     }
     if ($aStrokeFileName != '') {
         if ($aStrokeFileName == 'auto') {
             $aStrokeFileName = GenImgName();
         }
         if (file_exists($aStrokeFileName)) {
             // Wait for lock (to make sure no readers are trying to access the image)
             $fd = fopen($aStrokeFileName, 'w');
             $lock = flock($fd, LOCK_EX);
             // Since the image write routines only accepts a filename which must not
             // exist we need to delete the old file first
             if (!@unlink($aStrokeFileName)) {
                 $lock = flock($fd, LOCK_UN);
                 JpGraphError::RaiseL(25111, $aStrokeFileName);
                 //(" Can't delete cached image $aStrokeFileName. Permission problem?");
             }
             $aImage->Stream($aStrokeFileName);
             $lock = flock($fd, LOCK_UN);
             fclose($fd);
         } else {
             $aImage->Stream($aStrokeFileName);
         }
         return;
     }
     if ($aCacheFileName != '' && USE_CACHE) {
         $aCacheFileName = $this->cache_dir . $aCacheFileName;
         if (file_exists($aCacheFileName)) {
             if (!$aInline) {
                 // If we are generating image off-line (just writing to the cache)
                 // and the file exists and is still valid (no timeout)
                 // then do nothing, just return.
                 $diff = time() - filemtime($aCacheFileName);
                 if ($diff < 0) {
                     JpGraphError::RaiseL(25112, $aCacheFileName);
                     //(" Cached imagefile ($aCacheFileName) has file date in the future!!");
                 }
                 if ($this->timeout > 0 && $diff <= $this->timeout * 60) {
                     return;
                 }
             }
             // Wait for lock (to make sure no readers are trying to access the image)
             $fd = fopen($aCacheFileName, 'w');
             $lock = flock($fd, LOCK_EX);
             if (!@unlink($aCacheFileName)) {
                 $lock = flock($fd, LOCK_UN);
                 JpGraphError::RaiseL(25113, $aStrokeFileName);
                 //(" Can't delete cached image $aStrokeFileName. Permission problem?");
             }
             $aImage->Stream($aCacheFileName);
             $lock = flock($fd, LOCK_UN);
             fclose($fd);
         } else {
             $this->MakeDirs(dirname($aCacheFileName));
             if (!is_writeable(dirname($aCacheFileName))) {
                 JpGraphError::RaiseL(25114, $aCacheFileName);
                 //('PHP has not enough permissions to write to the cache file '.$aCacheFileName.'. Please make sure that the user running PHP has write permission for this file if you wan to use the cache system with JpGraph.');
             }
             $aImage->Stream($aCacheFileName);
         }
         $res = true;
         // Set group to specified
         if (CACHE_FILE_GROUP != '') {
             $res = @chgrp($aCacheFileName, CACHE_FILE_GROUP);
         }
         if (CACHE_FILE_MOD != '') {
             $res = @chmod($aCacheFileName, CACHE_FILE_MOD);
         }
         if (!$res) {
             JpGraphError::RaiseL(25115, $aStrokeFileName);
             //(" Can't set permission for cached image $aStrokeFileName. Permission problem?");
         }
         $aImage->Destroy();
         if ($aInline) {
             if ($fh = @fopen($aCacheFileName, "rb")) {
                 $aImage->Headers();
                 fpassthru($fh);
                 return;
             } else {
                 JpGraphError::RaiseL(25116, $aFile);
                 //(" Cant open file from cache [$aFile]");
             }
         }
     } elseif ($aInline) {
         $aImage->Headers();
         $aImage->Stream();
         return;
     }
 }
开发者ID:hcvcastro,项目名称:pxp,代码行数:93,代码来源:gd_image.inc.php

示例5: array

<?php

include "../jpgraph.php";
include "../jpgraph_pie.php";
// Some data
$data = array(40, 21, 17, 14, 23);
// Create the Pie Graph.
$graph = new PieGraph(300, 200);
$graph->SetShadow();
// Set A title for the plot
$graph->title->Set("Client side image map");
$graph->title->SetFont(FF_FONT1, FS_BOLD);
// Create
$p1 = new PiePlot($data);
$p1->SetLegends(array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul"));
$targ = array("pie_csimex1.php#1", "pie_csimex1.php#2", "pie_csimex1.php#3", "pie_csimex1.php#4", "pie_csimex1.php#5", "pie_csimex1.php#6");
$alts = array("val=%v", "val=%v", "val=%v", "val=%v", "val=%v", "val=%v");
$p1->SetCSIMTargets($targ, $alts);
$graph->Add($p1);
$graph->Stroke(GenImgName());
echo $graph->GetHTMLImageMap("myimagemap");
echo "<img src=\"" . GenImgName() . "\" ISMAP USEMAP=\"#myimagemap\" border=0>";
?>


开发者ID:BackupTheBerlios,项目名称:milaninegw-svn,代码行数:23,代码来源:pie_csimex1.php

示例6: Graph

 function Graph($aWidth = 300, $aHeight = 200, $aCachedName = "", $aTimeOut = 0, $aInline = true)
 {
     global $gJpgBrandTiming;
     // If timing is used create a new timing object
     if ($gJpgBrandTiming) {
         global $tim;
         $tim = new JpgTimer();
         $tim->Push();
     }
     if (!is_numeric($aWidth) || !is_numeric($aHeight)) {
         JpGraphError::RaiseL(25008);
         //('Image width/height argument in Graph::Graph() must be numeric');
     }
     // Automatically generate the image file name based on the name of the script that
     // generates the graph
     if ($aCachedName == "auto") {
         $aCachedName = GenImgName();
     }
     // Should the image be streamed back to the browser or only to the cache?
     $this->inline = $aInline;
     $this->img = new RotImage($aWidth, $aHeight);
     $this->cache = new ImgStreamCache($this->img);
     $this->cache->SetTimeOut($aTimeOut);
     $this->title = new Text();
     $this->title->ParagraphAlign('center');
     $this->title->SetFont(FF_FONT2, FS_BOLD);
     $this->title->SetMargin(3);
     $this->title->SetAlign('center');
     $this->subtitle = new Text();
     $this->subtitle->ParagraphAlign('center');
     $this->subtitle->SetMargin(2);
     $this->subtitle->SetAlign('center');
     $this->subsubtitle = new Text();
     $this->subsubtitle->ParagraphAlign('center');
     $this->subsubtitle->SetMargin(2);
     $this->subsubtitle->SetAlign('center');
     $this->legend = new Legend();
     $this->footer = new Footer();
     // Window doesn't like '?' in the file name so replace it with an '_'
     $aCachedName = str_replace("?", "_", $aCachedName);
     // If the cached version exist just read it directly from the
     // cache, stream it back to browser and exit
     if ($aCachedName != "" && READ_CACHE && $aInline) {
         if ($this->cache->GetAndStream($aCachedName)) {
             exit;
         }
     }
     $this->cache_name = $aCachedName;
     $this->SetTickDensity();
     // Normal density
     $this->tabtitle = new GraphTabTitle();
 }
开发者ID:risyasin,项目名称:webpagetest,代码行数:52,代码来源:jpgraph.php

示例7: PutAndStream

 function PutAndStream(&$aImage, $aCacheFileName, $aInline, $aStrokeFileName)
 {
     global $gJpgBrandTiming;
     if ($gJpgBrandTiming) {
         global $tim;
         $t = $tim->Pop() / 1000.0;
         $c = $aImage->SetColor("black");
         $t = sprintf(BRAND_TIME_FORMAT, round($t, 3));
         imagestring($this->img->img, 2, 5, $this->img->height - 20, $t, $c);
     }
     if (_FORCE_IMGTOFILE) {
         $aStrokeFileName = _FORCE_IMGDIR . GenImgName();
     }
     if ($aStrokeFileName != "") {
         if ($aStrokeFileName == "auto") {
             $aStrokeFileName = GenImgName();
         }
         if (file_exists($aStrokeFileName)) {
             if (!@unlink($aStrokeFileName)) {
                 JpGraphError::RaiseL(25111, $aStrokeFileName);
             }
         }
         $aImage->Stream($aStrokeFileName);
         return;
     }
     if ($aCacheFileName != "" && USE_CACHE) {
         $aCacheFileName = $this->cache_dir . $aCacheFileName;
         if (file_exists($aCacheFileName)) {
             if (!$aInline) {
                 $diff = time() - filemtime($aCacheFileName);
                 if ($diff < 0) {
                     JpGraphError::RaiseL(25112, $aCacheFileName);
                 }
                 if ($this->timeout > 0 && $diff <= $this->timeout * 60) {
                     return;
                 }
             }
             if (!@unlink($aCacheFileName)) {
                 JpGraphError::RaiseL(25113, $aStrokeFileName);
             }
             $aImage->Stream($aCacheFileName);
         } else {
             $this->MakeDirs(dirname($aCacheFileName));
             if (!is_writeable(dirname($aCacheFileName))) {
                 JpGraphError::RaiseL(25114, $aCacheFileName);
             }
             $aImage->Stream($aCacheFileName);
         }
         $res = true;
         if (CACHE_FILE_GROUP != "") {
             $res = @chgrp($aCacheFileName, CACHE_FILE_GROUP);
         }
         if (CACHE_FILE_MOD != "") {
             $res = @chmod($aCacheFileName, CACHE_FILE_MOD);
         }
         if (!$res) {
             JpGraphError::RaiseL(25115, $aStrokeFileName);
         }
         $aImage->Destroy();
         if ($aInline) {
             if ($fh = @fopen($aCacheFileName, "rb")) {
                 $this->img->Headers();
                 fpassthru($fh);
                 return;
             } else {
                 JpGraphError::RaiseL(25116, $aFile);
             }
         }
     } elseif ($aInline) {
         $this->img->Headers();
         $aImage->Stream();
         return;
     }
 }
开发者ID:natanoj,项目名称:nuBuilderPro,代码行数:74,代码来源:jpgraph.php

示例8: Graph

 function Graph($aWidth = 300, $aHeight = 200, $aCachedName = "", $aTimeOut = 0, $aInline = true)
 {
     // If timing is used create a new timing object
     if (BRAND_TIMING) {
         global $tim;
         $tim = new JpgTimer();
         $tim->Push();
     }
     // Automatically generate the image file name based on the name of the script that
     // generates the graph
     if ($aCachedName == "auto") {
         $aCachedName = GenImgName();
     }
     // Should the image be streamed back to the browser or only to the cache?
     $this->inline = $aInline;
     $this->img = new RotImage($aWidth, $aHeight);
     $this->cache = new ImgStreamCache($this->img);
     $this->cache->SetTimeOut($aTimeOut);
     $this->title = new Text("");
     $this->subtitle = new Text("");
     $this->legend = new Legend();
     // If the cached version exist just read it directly from the
     // cache, stream it back to browser and exit
     if ($aCachedName != "" && READ_CACHE && $aInline) {
         if ($this->cache->GetAndStream($aCachedName)) {
             exit;
         }
     }
     $this->cache_name = $aCachedName;
     $this->SetTickDensity();
     // Normal density
 }
开发者ID:ahviplc,项目名称:judgegirl,代码行数:32,代码来源:jpgraph.php


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