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


PHP phpthumb_functions::FunctionIsDisabled方法代码示例

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


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

示例1: ob_start

// this script relies on the superglobal arrays, fake it here for old PHP versions
if (phpversion() < '4.1.0') {
    $_SERVER = $HTTP_SERVER_VARS;
    $_GET = $HTTP_GET_VARS;
}
// instantiate a new phpThumb() object
ob_start();
if (!(include_once dirname(__FILE__) . '/phpthumb.class.php')) {
    ob_end_flush();
    die('failed to include_once("' . realpath(dirname(__FILE__) . '/phpthumb.class.php') . '")');
}
ob_end_clean();
$phpThumb = new phpThumb();
$phpThumb->DebugTimingMessage('phpThumb.php start', __FILE__, __LINE__, $starttime);
$phpThumb->SetParameter('config_error_die_on_error', true);
if (!phpthumb_functions::FunctionIsDisabled('set_time_limit')) {
    set_time_limit(60);
    // shouldn't take nearly this long in most cases, but with many filters and/or a slow server...
}
// phpThumbDebug[0] used to be here, but may reveal too much
// info when high_security_mode should be enabled (not set yet)
if (file_exists(dirname(__FILE__) . '/phpThumb.config.php')) {
    ob_start();
    if (include_once dirname(__FILE__) . '/phpThumb.config.php') {
        // great
    } else {
        ob_end_flush();
        $phpThumb->ErrorImage('failed to include_once(' . dirname(__FILE__) . '/phpThumb.config.php) - realpath="' . realpath(dirname(__FILE__) . '/phpThumb.config.php') . '"');
    }
    ob_end_clean();
} elseif (file_exists(dirname(__FILE__) . '/phpThumb.config.php.default')) {
开发者ID:CrazyBobik,项目名称:allotaxi.test,代码行数:31,代码来源:phpThumb.php

示例2: SafeURLread

 function SafeURLread($url, &$error, $timeout = 10, $followredirects = true)
 {
     $error = '';
     $parsed_url = phpthumb_functions::ParseURLbetter($url);
     $alreadyLookedAtURLs[trim($url)] = true;
     while (true) {
         $tryagain = false;
         $rawData = phpthumb_functions::URLreadFsock(@$parsed_url['host'], @$parsed_url['path'] . '?' . @$parsed_url['query'], $errstr, true, @$parsed_url['port'] ? @$parsed_url['port'] : 80, $timeout);
         if (eregi('302 [a-z ]+; Location\\: (http.*)', $errstr, $matches)) {
             $matches[1] = trim(@$matches[1]);
             if (!@$alreadyLookedAtURLs[$matches[1]]) {
                 // loop through and examine new URL
                 $error .= 'URL "' . $url . '" redirected to "' . $matches[1] . '"';
                 $tryagain = true;
                 $alreadyLookedAtURLs[$matches[1]] = true;
                 $parsed_url = phpthumb_functions::ParseURLbetter($matches[1]);
             }
         }
         if (!$tryagain) {
             break;
         }
     }
     if ($rawData === false) {
         $error .= 'Error opening "' . $url . '":' . "\n\n" . $errstr;
         return false;
     } elseif ($rawData === null) {
         // fall through
         $error .= 'Error opening "' . $url . '":' . "\n\n" . $errstr;
     } else {
         return $rawData;
     }
     if (function_exists('curl_version') && !phpthumb_functions::FunctionIsDisabled('curl_exec')) {
         $ch = curl_init();
         curl_setopt($ch, CURLOPT_URL, $url);
         curl_setopt($ch, CURLOPT_HEADER, false);
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
         curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
         curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
         $rawData = curl_exec($ch);
         curl_close($ch);
         if (strlen($rawData) > 0) {
             $error .= 'CURL succeeded (' . strlen($rawData) . ' bytes); ';
             return $rawData;
         }
         $error .= 'CURL available but returned no data; ';
     } else {
         $error .= 'CURL unavailable; ';
     }
     $BrokenURLfopenPHPversions = array('4.4.2');
     if (in_array(phpversion(), $BrokenURLfopenPHPversions)) {
         $error .= 'fopen(URL) broken in PHP v' . phpversion() . '; ';
     } elseif (@ini_get('allow_url_fopen')) {
         $rawData = '';
         $error_fopen = '';
         ob_start();
         if ($fp = fopen($url, 'rb')) {
             do {
                 $buffer = fread($fp, 8192);
                 $rawData .= $buffer;
             } while (strlen($buffer) > 0);
             fclose($fp);
         } else {
             $error_fopen .= trim(strip_tags(ob_get_contents()));
         }
         ob_end_clean();
         $error .= $error_fopen;
         if (!$error_fopen) {
             $error .= '; "allow_url_fopen" succeeded (' . strlen($rawData) . ' bytes); ';
             return $rawData;
         }
         $error .= '; "allow_url_fopen" enabled but returned no data (' . $error_fopen . '); ';
     } else {
         $error .= '"allow_url_fopen" disabled; ';
     }
     return false;
 }
开发者ID:mashbro,项目名称:Codefight-CMS,代码行数:76,代码来源:phpthumb.functions.php

示例3: PlotBMP

 function PlotBMP(&$BMPinfo)
 {
     $starttime = time();
     if (!isset($BMPinfo['bmp']['data']) || !is_array($BMPinfo['bmp']['data'])) {
         echo 'ERROR: no pixel data<BR>';
         return false;
     }
     if (!phpthumb_functions::FunctionIsDisabled('set_time_limit')) {
         set_time_limit(intval(round($BMPinfo['resolution_x'] * $BMPinfo['resolution_y'] / 10000)));
     }
     $im = $this->PlotPixelsGD($BMPinfo['bmp']);
     if (headers_sent()) {
         echo 'plotted ' . $BMPinfo['resolution_x'] * $BMPinfo['resolution_y'] . ' pixels in ' . (time() - $starttime) . ' seconds<BR>';
         ImageDestroy($im);
         exit;
     } else {
         header('Content-Type: image/png');
         ImagePNG($im);
         ImageDestroy($im);
         return true;
     }
     return false;
 }
开发者ID:artjoker,项目名称:foodelivery,代码行数:23,代码来源:phpthumb.bmp.php

示例4: getGD_PixelPlotterVersion

 function getGD_PixelPlotterVersion()
 {
     if (!$this->m_bLoaded) {
         return false;
     }
     // PREPARE COLOR TABLE (RGBQUADs)
     if ($this->m_img->m_gih->m_bLocalClr) {
         $pal = $this->m_img->m_gih->m_colorTable->toString();
     } elseif ($this->m_gfh->m_bGlobalClr) {
         $pal = $this->m_gfh->m_colorTable->toString();
     } else {
         die('No color table available in getGD_PixelPlotterVersion()');
     }
     $PlottingIMG = ImageCreate($this->m_gfh->m_nWidth, $this->m_gfh->m_nHeight);
     $NumColorsInPal = floor(strlen($pal) / 3);
     for ($i = 0; $i < $NumColorsInPal; $i++) {
         $ThisImageColor[$i] = ImageColorAllocate($PlottingIMG, ord($pal[$i * 3 + 0]), ord($pal[$i * 3 + 1]), ord($pal[$i * 3 + 2]));
     }
     // PREPARE BITMAP BITS
     $data = $this->m_img->m_data;
     $nPxl = ($this->m_gfh->m_nHeight - 1) * $this->m_gfh->m_nWidth;
     for ($y = 0; $y < $this->m_gfh->m_nHeight; $y++) {
         if (!phpthumb_functions::FunctionIsDisabled('set_time_limit')) {
             set_time_limit(30);
         }
         for ($x = 0; $x < $this->m_gfh->m_nWidth; $x++, $nPxl++) {
             if ($x >= $this->m_img->m_gih->m_nLeft && $y >= $this->m_img->m_gih->m_nTop && $x < $this->m_img->m_gih->m_nLeft + $this->m_img->m_gih->m_nWidth && $y < $this->m_img->m_gih->m_nTop + $this->m_img->m_gih->m_nHeight) {
                 // PART OF IMAGE
                 if (@$this->m_img->m_bTrans && ord($data[$nPxl]) == $this->m_img->m_nTrans) {
                     ImageSetPixel($PlottingIMG, $x, $this->m_gfh->m_nHeight - $y - 1, $ThisImageColor[$this->m_gfh->m_nBgColor]);
                 } else {
                     ImageSetPixel($PlottingIMG, $x, $this->m_gfh->m_nHeight - $y - 1, $ThisImageColor[ord($data[$nPxl])]);
                 }
             } else {
                 // BACKGROUND
                 ImageSetPixel($PlottingIMG, $x, $this->m_gfh->m_nHeight - $y - 1, $ThisImageColor[$this->m_gfh->m_nBgColor]);
             }
         }
         $nPxl -= $this->m_gfh->m_nWidth << 1;
     }
     return $PlottingIMG;
 }
开发者ID:nskolaris,项目名称:employment-site,代码行数:42,代码来源:phpthumb.gif.php

示例5: SafeURLread

 function SafeURLread($url, &$error)
 {
     $error = '';
     $parsed_url = @parse_url($url);
     $rawData = phpthumb_functions::URLreadFsock(@$parsed_url['host'], @$parsed_url['path'], $errstr, true, @$parsed_url['port'] ? @$parsed_url['port'] : 80);
     $error .= 'Error: ' . $errstr . "\n" . $url;
     if ($rawData === false) {
         return false;
     } elseif ($rawData === null) {
         // fall through
     } else {
         return $rawData;
     }
     $BrokenURLfopenPHPversions = array('4.4.2');
     if (in_array(phpversion(), $BrokenURLfopenPHPversions)) {
         $error .= 'fopen(URL) broken in PHP v' . phpversion() . '; ';
     } elseif (@ini_get('allow_url_fopen')) {
         $rawData = '';
         ob_start();
         if ($fp = fopen($url, 'rb')) {
             do {
                 $buffer = fread($fp, 8192);
                 $rawData .= $buffer;
             } while (strlen($buffer) > 0);
             fclose($fp);
         } else {
             $error .= trim(strip_tags(ob_get_contents()));
         }
         ob_end_clean();
         if (!$error) {
             return $rawData;
         }
         $error .= '; "allow_url_fopen" enabled but returned no data; ';
     } else {
         $error .= '"allow_url_fopen" disabled; ';
     }
     if (function_exists('curl_version') && !phpthumb_functions::FunctionIsDisabled('curl_exec')) {
         $ch = curl_init();
         curl_setopt($ch, CURLOPT_URL, $url);
         curl_setopt($ch, CURLOPT_HEADER, false);
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
         curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
         $rawData = curl_exec($ch);
         curl_close($ch);
         if (strlen($rawData) > 0) {
             return $rawData;
         }
         $error .= 'CURL available but returned no data; ';
     } else {
         $error .= 'CURL unavailable; ';
     }
     return false;
 }
开发者ID:kinj1987,项目名称:evo-league,代码行数:53,代码来源:phpthumb.functions.php

示例6: URLreadFsock

 static function URLreadFsock($host, $file, &$errstr, $successonly = true, $port = 80, $timeout = 10)
 {
     if (!function_exists('fsockopen') || phpthumb_functions::FunctionIsDisabled('fsockopen')) {
         $errstr = 'fsockopen() unavailable';
         return false;
     }
     if ($fp = @fsockopen($host, $port, $errno, $errstr, $timeout)) {
         $out = 'GET ' . $file . ' HTTP/1.0' . "\r\n";
         $out .= 'Host: ' . $host . "\r\n";
         $out .= 'Connection: Close' . "\r\n\r\n";
         fwrite($fp, $out);
         $isHeader = true;
         $Data_header = '';
         $Data_body = '';
         $header_newlocation = '';
         while (!feof($fp)) {
             $line = fgets($fp, 1024);
             if ($isHeader) {
                 $Data_header .= $line;
             } else {
                 $Data_body .= $line;
             }
             if (preg_match('#^HTTP/[\\.0-9]+ ([0-9]+) (.+)$#i', rtrim($line), $matches)) {
                 list($dummy, $errno, $errstr) = $matches;
                 $errno = intval($errno);
             } elseif (preg_match('#^Location: (.*)$#i', rtrim($line), $matches)) {
                 $header_newlocation = $matches[1];
             }
             if ($isHeader && $line == "\r\n") {
                 $isHeader = false;
                 if ($successonly) {
                     switch ($errno) {
                         case 200:
                             // great, continue
                             break;
                         default:
                             $errstr = $errno . ' ' . $errstr . ($header_newlocation ? '; Location: ' . $header_newlocation : '');
                             fclose($fp);
                             return false;
                             break;
                     }
                 }
             }
         }
         fclose($fp);
         return $Data_body;
     }
     return null;
 }
开发者ID:artjoker,项目名称:foodelivery,代码行数:49,代码来源:phpthumb.functions.php


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