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


PHP phpthumb_functions类代码示例

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


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

示例1: RedirectToCachedFile

function RedirectToCachedFile()
{
    global $phpThumb;
    $nice_cachefile = str_replace(DIRECTORY_SEPARATOR, '/', $phpThumb->cache_filename);
    $nice_docroot = str_replace(DIRECTORY_SEPARATOR, '/', rtrim($phpThumb->config_document_root, '/\\'));
    $parsed_url = phpthumb_functions::ParseURLbetter(@$_SERVER['HTTP_REFERER']);
    $nModified = filemtime($phpThumb->cache_filename);
    if ($phpThumb->config_nooffsitelink_enabled && !empty($_SERVER['HTTP_REFERER']) && !in_array(@$parsed_url['host'], $phpThumb->config_nooffsitelink_valid_domains)) {
        $phpThumb->DebugMessage('Would have used cached (image/' . $phpThumb->thumbnailFormat . ') file "' . $phpThumb->cache_filename . '" (Last-Modified: ' . gmdate('D, d M Y H:i:s', $nModified) . ' GMT), but skipping because $_SERVER[HTTP_REFERER] (' . @$_SERVER['HTTP_REFERER'] . ') is not in $phpThumb->config_nooffsitelink_valid_domains (' . implode(';', $phpThumb->config_nooffsitelink_valid_domains) . ')', __FILE__, __LINE__);
    } elseif ($phpThumb->phpThumbDebug) {
        $phpThumb->DebugTimingMessage('skipped using cached image', __FILE__, __LINE__);
        $phpThumb->DebugMessage('Would have used cached file, but skipping due to phpThumbDebug', __FILE__, __LINE__);
        $phpThumb->DebugMessage('* Would have sent headers (1): Last-Modified: ' . gmdate('D, d M Y H:i:s', $nModified) . ' GMT', __FILE__, __LINE__);
        if ($getimagesize = @getimagesize($phpThumb->cache_filename)) {
            $phpThumb->DebugMessage('* Would have sent headers (2): Content-Type: ' . phpthumb_functions::ImageTypeToMIMEtype($getimagesize[2]), __FILE__, __LINE__);
        }
        if (preg_match('#^' . preg_quote($nice_docroot) . '(.*)$#', $nice_cachefile, $matches)) {
            $phpThumb->DebugMessage('* Would have sent headers (3): Location: ' . dirname($matches[1]) . '/' . urlencode(basename($matches[1])), __FILE__, __LINE__);
        } else {
            $phpThumb->DebugMessage('* Would have sent data: readfile(' . $phpThumb->cache_filename . ')', __FILE__, __LINE__);
        }
    } else {
        if (headers_sent()) {
            $phpThumb->ErrorImage('Headers already sent (' . basename(__FILE__) . ' line ' . __LINE__ . ')');
            exit;
        }
        SendSaveAsFileHeaderIfNeeded();
        header('Pragma: private');
        header('Cache-Control: max-age=' . $phpThumb->getParameter('config_cache_maxage'));
        header('Expires: ' . date(DATE_RFC1123, time() + $phpThumb->getParameter('config_cache_maxage')));
        if (!empty($_SERVER['HTTP_IF_MODIFIED_SINCE']) && $nModified == strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) && !empty($_SERVER['SERVER_PROTOCOL'])) {
            header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $nModified) . ' GMT');
            header($_SERVER['SERVER_PROTOCOL'] . ' 304 Not Modified');
            exit;
        }
        header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $nModified) . ' GMT');
        header('ETag: "' . md5_file($phpThumb->cache_filename) . '"');
        if ($getimagesize = @getimagesize($phpThumb->cache_filename)) {
            header('Content-Type: ' . phpthumb_functions::ImageTypeToMIMEtype($getimagesize[2]));
        } elseif (preg_match('#\\.ico$#i', $phpThumb->cache_filename)) {
            header('Content-Type: image/x-icon');
        }
        header('Content-Length: ' . filesize($phpThumb->cache_filename));
        if (empty($phpThumb->config_cache_force_passthru) && preg_match('#^' . preg_quote($nice_docroot) . '(.*)$#', $nice_cachefile, $matches)) {
            header('Location: ' . dirname($matches[1]) . '/' . urlencode(basename($matches[1])));
        } else {
            @readfile($phpThumb->cache_filename);
        }
        exit;
    }
    return true;
}
开发者ID:geekwright,项目名称:XoopsCore25,代码行数:52,代码来源:phpThumb.php

示例2: SendSaveAsFileHeaderIfNeeded

function SendSaveAsFileHeaderIfNeeded()
{
    if (!empty($_GET['down'])) {
        $downloadfilename = ereg_replace('[/\\:\\*\\?"<>|]', '_', $_GET['down']);
        if (phpthumb_functions::version_compare_replacement(phpversion(), '4.1.0', '>=')) {
            $downloadfilename = trim($downloadfilename, '.');
        }
        if (!empty($downloadfilename)) {
            header('Content-Disposition: attachment; filename="' . $downloadfilename . '"');
        }
    }
    return true;
}
开发者ID:BackupTheBerlios,项目名称:milaninegw-svn,代码行数:13,代码来源:phpThumb.php

示例3: spit_phpthumb_image

function spit_phpthumb_image($filepath, $configarray = array())
{
    // set up class
    global $CFG, $PHPTHUMB_CONFIG;
    $phpThumb = new phpThumb();
    // import default config
    if (!empty($PHPTHUMB_CONFIG)) {
        foreach ($PHPTHUMB_CONFIG as $key => $value) {
            $keyname = 'config_' . $key;
            $phpThumb->setParameter($keyname, $value);
        }
    }
    // import passed params
    if (!empty($configarray)) {
        foreach ($configarray as $key => $value) {
            $keyname = $key;
            $phpThumb->setParameter($keyname, $value);
        }
    }
    $phpThumb->setSourceFilename($filepath);
    if (!is_file($phpThumb->sourceFilename) && !phpthumb_functions::gd_version()) {
        if (!headers_sent()) {
            // base64-encoded error image in GIF format
            $ERROR_NOGD = 'R0lGODlhIAAgALMAAAAAABQUFCQkJDY2NkZGRldXV2ZmZnJycoaGhpSUlKWlpbe3t8XFxdXV1eTk5P7+/iwAAAAAIAAgAAAE/vDJSau9WILtTAACUinDNijZtAHfCojS4W5H+qxD8xibIDE9h0OwWaRWDIljJSkUJYsN4bihMB8th3IToAKs1VtYM75cyV8sZ8vygtOE5yMKmGbO4jRdICQCjHdlZzwzNW4qZSQmKDaNjhUMBX4BBAlmMywFSRWEmAI6b5gAlhNxokGhooAIK5o/pi9vEw4Lfj4OLTAUpj6IabMtCwlSFw0DCKBoFqwAB04AjI54PyZ+yY3TD0ss2YcVmN/gvpcu4TOyFivWqYJlbAHPpOntvxNAACcmGHjZzAZqzSzcq5fNjxFmAFw9iFRunD1epU6tsIPmFCAJnWYE0FURk7wJDA0MTKpEzoWAAskiAAA7';
            header('Content-Type: image/gif');
            echo base64_decode($ERROR_NOGD);
        } else {
            echo '*** ERROR: No PHP-GD support available ***';
        }
        exit;
    }
    $phpThumb->SetCacheFilename();
    if (!file_exists($phpThumb->cache_filename) && is_writable(dirname($phpThumb->cache_filename))) {
        //         error_log("generating to cache: " . $phpThumb->cache_filename);
        $phpThumb->CleanUpCacheDirectory();
        $phpThumb->GenerateThumbnail();
        $phpThumb->RenderToFile($phpThumb->cache_filename);
    }
    if (is_file($phpThumb->cache_filename)) {
        //         error_log("sending from cache: " . $phpThumb->cache_filename);
        if ($getimagesize = @GetImageSize($phpThumb->cache_filename)) {
            $mimetype = phpthumb_functions::ImageTypeToMIMEtype($getimagesize[2]);
        }
        spitfile_with_mtime_check($phpThumb->cache_filename, $mimetype);
    } else {
        //         error_log("phpthumb cache file doesn't exist: " . $phpThumb->cache_filename);
        $phpThumb->GenerateThumbnail();
        $phpThumb->OutputThumbnail();
        exit;
    }
}
开发者ID:pzingg,项目名称:saugus_elgg,代码行数:51,代码来源:iconslib.php

示例4: dump

 public function dump($preConf)
 {
     $imgDirecoryPrefix = $this->getTrackId() ? APP_ROOT : \Slim\Slim::getInstance()->config['mpd']['musicdir'];
     $phpThumb = self::getPhpThumb();
     $phpThumb->setSourceFilename($imgDirecoryPrefix . $this->getRelativePath());
     $phpThumb->setParameter('config_output_format', 'jpg');
     switch ($preConf) {
         case 50:
         case 100:
         case 300:
         case 1000:
             $phpThumb->setParameter('w', $preConf);
             break;
         default:
             $phpThumb->setParameter('w', 300);
     }
     $phpThumb->SetCacheFilename();
     // check if we already have a cached image
     if (is_file($phpThumb->cache_filename) === FALSE || is_readable($phpThumb->cache_filename) === FALSE) {
         $phpThumb->GenerateThumbnail();
         \phpthumb_functions::EnsureDirectoryExists(dirname($phpThumb->cache_filename));
         $phpThumb->RenderToFile($phpThumb->cache_filename);
         if (is_file($phpThumb->cache_filename) === TRUE) {
             chmod($phpThumb->cache_filename, 0777);
         } else {
             // something went wrong
             // TODO: how to handle this?
             // TODO: make sure we have no infinite loop...
             return self::getFallbackImage()->dump($preConf);
         }
     }
     #\Slim\Slim::getInstance()->response()->headers->set('Content-Type', 'image/jpeg');
     header('Content-Type: image/jpeg');
     readfile($phpThumb->cache_filename);
     exit;
 }
开发者ID:daskleinesys,项目名称:slimpd,代码行数:36,代码来源:Bitmap.php

示例5: generatePeakFile

 private function generatePeakFile()
 {
     // extract peaks
     $peakValues = $this->getPeaks();
     // shorten values to configured limit
     $peakValues = $this->limitArray($peakValues, $this->peakFileResolution);
     \phpthumb_functions::EnsureDirectoryExists(dirname($this->peakValuesFilePath));
     file_put_contents($this->peakValuesFilePath, join("\n", $peakValues));
     return;
 }
开发者ID:daskleinesys,项目名称:slimpd,代码行数:10,代码来源:main.php

示例6: ImageCreateFromStringReplacement

 function ImageCreateFromStringReplacement(&$RawImageData, $DieOnErrors = false)
 {
     // there are serious bugs in the non-bundled versions of GD which may cause
     // PHP to segfault when calling ImageCreateFromString() - avoid if at all possible
     // when not using a bundled version of GD2
     $gd_info = phpthumb_functions::gd_info();
     if (strpos($gd_info['GD Version'], 'bundled') !== false) {
         return @ImageCreateFromString($RawImageData);
     }
     switch (substr($RawImageData, 0, 3)) {
         case 'GIF':
             $ICFSreplacementFunctionName = 'ImageCreateFromGIF';
             break;
         case "ÿØÿ":
             $ICFSreplacementFunctionName = 'ImageCreateFromJPEG';
             break;
         case "‰" . 'PN':
             $ICFSreplacementFunctionName = 'ImageCreateFromPNG';
             break;
         default:
             $this->ErrorImage('Unknown image type identified by "' . substr($this->rawImageData, 0, 3) . '" (' . phpthumb_functions::HexCharDisplay(substr($this->rawImageData, 0, 3)) . ') in ImageCreateFromStringReplacement()');
             break;
     }
     if ($tempnam = tempnam($this->config_temp_directory, 'pThumb')) {
         if ($fp_tempnam = @fopen($tempnam, 'wb')) {
             fwrite($fp_tempnam, $RawImageData);
             fclose($fp_tempnam);
             if ($ICFSreplacementFunctionName == 'ImageCreateFromGIF' && !function_exists($ICFSreplacementFunctionName)) {
                 // Need to create from GIF file, but ImageCreateFromGIF does not exist
                 if (@(include_once 'phpthumb.gif.php')) {
                     // gif_loadFileToGDimageResource() cannot read from raw data, write to file first
                     if ($tempfilename = tempnam($this->config_temp_directory, 'pThumb')) {
                         if ($fp_tempfile = @fopen($tempfilename, 'wb')) {
                             fwrite($fp_tempfile, $RawImageData);
                             fclose($fp_tempfile);
                             $gdimg_source = gif_loadFileToGDimageResource($tempfilename);
                             unlink($tempfilename);
                             return $gdimg_source;
                             break;
                         } else {
                             $ErrorMessage = 'Failed to open tempfile in ' . __FILE__ . ' on line ' . __LINE__;
                         }
                     } else {
                         $ErrorMessage = 'Failed to open generate tempfile name in ' . __FILE__ . ' on line ' . __LINE__;
                     }
                 } else {
                     $ErrorMessage = 'Failed to include required file "phpthumb.gif.php" in ' . __FILE__ . ' on line ' . __LINE__;
                 }
             } elseif (function_exists($ICFSreplacementFunctionName) && ($gdimg_source = $ICFSreplacementFunctionName($tempnam))) {
                 // great
                 unlink($tempnam);
                 return $gdimg_source;
             } else {
                 // GD functions not available
                 // base64-encoded error image in GIF format
                 $ERROR_NOGD = 'R0lGODlhIAAgALMAAAAAABQUFCQkJDY2NkZGRldXV2ZmZnJycoaGhpSUlKWlpbe3t8XFxdXV1eTk5P7+/iwAAAAAIAAgAAAE/vDJSau9WILtTAACUinDNijZtAHfCojS4W5H+qxD8xibIDE9h0OwWaRWDIljJSkUJYsN4bihMB8th3IToAKs1VtYM75cyV8sZ8vygtOE5yMKmGbO4jRdICQCjHdlZzwzNW4qZSQmKDaNjhUMBX4BBAlmMywFSRWEmAI6b5gAlhNxokGhooAIK5o/pi9vEw4Lfj4OLTAUpj6IabMtCwlSFw0DCKBoFqwAB04AjI54PyZ+yY3TD0ss2YcVmN/gvpcu4TOyFivWqYJlbAHPpOntvxNAACcmGHjZzAZqzSzcq5fNjxFmAFw9iFRunD1epU6tsIPmFCAJnWYE0FURk7wJDA0MTKpEzoWAAskiAAA7';
                 header('Content-type: image/gif');
                 echo base64_decode($ERROR_NOGD);
                 exit;
             }
         } else {
             $ErrorMessage = 'Failed to fopen(' . $tempnam . ', "wb") in ' . __FILE__ . ' on line ' . __LINE__ . "\n" . 'You may need to set $PHPTHUMB_CONFIG[temp_directory] in phpthumb.config.php';
         }
         unlink($tempnam);
     } else {
         $ErrorMessage = 'Failed to generate tempnam() in ' . __FILE__ . ' on line ' . __LINE__ . "\n" . 'You may need to set $PHPTHUMB_CONFIG[temp_directory] in phpthumb.config.php';
     }
     if ($DieOnErrors && !empty($ErrorMessage)) {
         die($ErrorMessage);
     }
     return false;
 }
开发者ID:BackupTheBerlios,项目名称:ydframework-svn,代码行数:72,代码来源:phpthumb.class.php

示例7: 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

示例8: GD2ICOstring

 function GD2ICOstring(&$gd_image_array)
 {
     foreach ($gd_image_array as $key => $gd_image) {
         $ImageWidths[$key] = ImageSX($gd_image);
         $ImageHeights[$key] = ImageSY($gd_image);
         $bpp[$key] = ImageIsTrueColor($gd_image) ? 32 : 24;
         $totalcolors[$key] = ImageColorsTotal($gd_image);
         $icXOR[$key] = '';
         for ($y = $ImageHeights[$key] - 1; $y >= 0; $y--) {
             for ($x = 0; $x < $ImageWidths[$key]; $x++) {
                 $argb = phpthumb_functions::GetPixelColor($gd_image, $x, $y);
                 $a = round(255 * ((127 - $argb['alpha']) / 127));
                 $r = $argb['red'];
                 $g = $argb['green'];
                 $b = $argb['blue'];
                 if ($bpp[$key] == 32) {
                     $icXOR[$key] .= chr($b) . chr($g) . chr($r) . chr($a);
                 } elseif ($bpp[$key] == 24) {
                     $icXOR[$key] .= chr($b) . chr($g) . chr($r);
                 }
                 if ($a < 128) {
                     @($icANDmask[$key][$y] .= '1');
                 } else {
                     @($icANDmask[$key][$y] .= '0');
                 }
             }
             // mask bits are 32-bit aligned per scanline
             while (strlen($icANDmask[$key][$y]) % 32) {
                 $icANDmask[$key][$y] .= '0';
             }
         }
         $icAND[$key] = '';
         foreach ($icANDmask[$key] as $y => $scanlinemaskbits) {
             for ($i = 0; $i < strlen($scanlinemaskbits); $i += 8) {
                 $icAND[$key] .= chr(bindec(str_pad(substr($scanlinemaskbits, $i, 8), 8, '0', STR_PAD_LEFT)));
             }
         }
     }
     foreach ($gd_image_array as $key => $gd_image) {
         $biSizeImage = $ImageWidths[$key] * $ImageHeights[$key] * ($bpp[$key] / 8);
         // BITMAPINFOHEADER - 40 bytes
         $BitmapInfoHeader[$key] = '';
         $BitmapInfoHeader[$key] .= "(";
         // DWORD  biSize;
         $BitmapInfoHeader[$key] .= phpthumb_functions::LittleEndian2String($ImageWidths[$key], 4);
         // LONG   biWidth;
         // The biHeight member specifies the combined
         // height of the XOR and AND masks.
         $BitmapInfoHeader[$key] .= phpthumb_functions::LittleEndian2String($ImageHeights[$key] * 2, 4);
         // LONG   biHeight;
         $BitmapInfoHeader[$key] .= "";
         // WORD   biPlanes;
         $BitmapInfoHeader[$key] .= chr($bpp[$key]) . "";
         // wBitCount;
         $BitmapInfoHeader[$key] .= "";
         // DWORD  biCompression;
         $BitmapInfoHeader[$key] .= phpthumb_functions::LittleEndian2String($biSizeImage, 4);
         // DWORD  biSizeImage;
         $BitmapInfoHeader[$key] .= "";
         // LONG   biXPelsPerMeter;
         $BitmapInfoHeader[$key] .= "";
         // LONG   biYPelsPerMeter;
         $BitmapInfoHeader[$key] .= "";
         // DWORD  biClrUsed;
         $BitmapInfoHeader[$key] .= "";
         // DWORD  biClrImportant;
     }
     $icondata = "";
     // idReserved;   // Reserved (must be 0)
     $icondata .= "";
     // idType;       // Resource Type (1 for icons)
     $icondata .= phpthumb_functions::LittleEndian2String(count($gd_image_array), 2);
     // idCount;      // How many images?
     $dwImageOffset = 6 + count($gd_image_array) * 16;
     foreach ($gd_image_array as $key => $gd_image) {
         // ICONDIRENTRY   idEntries[1]; // An entry for each image (idCount of 'em)
         $icondata .= chr($ImageWidths[$key]);
         // bWidth;          // Width, in pixels, of the image
         $icondata .= chr($ImageHeights[$key]);
         // bHeight;         // Height, in pixels, of the image
         $icondata .= chr($totalcolors[$key]);
         // bColorCount;     // Number of colors in image (0 if >=8bpp)
         $icondata .= "";
         // bReserved;       // Reserved ( must be 0)
         $icondata .= "";
         // wPlanes;         // Color Planes
         $icondata .= chr($bpp[$key]) . "";
         // wBitCount;       // Bits per pixel
         $dwBytesInRes = 40 + strlen($icXOR[$key]) + strlen($icAND[$key]);
         $icondata .= phpthumb_functions::LittleEndian2String($dwBytesInRes, 4);
         // dwBytesInRes;    // How many bytes in this resource?
         $icondata .= phpthumb_functions::LittleEndian2String($dwImageOffset, 4);
         // dwImageOffset;   // Where in the file is this image?
         $dwImageOffset += strlen($BitmapInfoHeader[$key]);
         $dwImageOffset += strlen($icXOR[$key]);
         $dwImageOffset += strlen($icAND[$key]);
     }
     foreach ($gd_image_array as $key => $gd_image) {
         $icondata .= $BitmapInfoHeader[$key];
         $icondata .= $icXOR[$key];
//.........这里部分代码省略.........
开发者ID:Vatia13,项目名称:funtime,代码行数:101,代码来源:phpthumb.ico.php

示例9: RedirectToCachedFile

function RedirectToCachedFile()
{
    global $phpThumb, $PHPTHUMB_CONFIG;
    $nice_cachefile = str_replace($phpThumb->osslash, '/', $phpThumb->cache_filename);
    $nice_docroot = str_replace($phpThumb->osslash, '/', rtrim($PHPTHUMB_CONFIG['document_root'], '/\\'));
    $parsed_url = @parse_url(@$_SERVER['HTTP_REFERER']);
    $nModified = filemtime($phpThumb->cache_filename);
    if ($phpThumb->config_nooffsitelink_enabled && @$_SERVER['HTTP_REFERER'] && !in_array(@$parsed_url['host'], $phpThumb->config_nooffsitelink_valid_domains)) {
        $phpThumb->DebugMessage('Would have used cached (image/' . $phpThumb->thumbnailFormat . ') file "' . $phpThumb->cache_filename . '" (Last-Modified: ' . gmdate('D, d M Y H:i:s', $nModified) . ' GMT), but skipping because $_SERVER[HTTP_REFERER] (' . @$_SERVER['HTTP_REFERER'] . ') is not in $phpThumb->config_nooffsitelink_valid_domains (' . implode(';', $phpThumb->config_nooffsitelink_valid_domains) . ')', __FILE__, __LINE__);
    } elseif ($phpThumb->phpThumbDebug) {
        $phpThumb->DebugMessage('Would have used cached file, but skipping due to phpThumbDebug', __FILE__, __LINE__);
        $phpThumb->DebugMessage('* Would have sent headers (1): Last-Modified: ' . gmdate('D, d M Y H:i:s', $nModified) . ' GMT', __FILE__, __LINE__);
        if ($getimagesize = @GetImageSize($phpThumb->cache_filename)) {
            $phpThumb->DebugMessage('* Would have sent headers (2): Content-Type: ' . phpthumb_functions::ImageTypeToMIMEtype($getimagesize[2]), __FILE__, __LINE__);
        }
        if (ereg('^' . preg_quote($nice_docroot) . '(.*)$', $nice_cachefile, $matches)) {
            $phpThumb->DebugMessage('* Would have sent headers (3): Location: ' . dirname($matches[1]) . '/' . urlencode(basename($matches[1])), __FILE__, __LINE__);
        } else {
            $phpThumb->DebugMessage('* Would have sent data: readfile(' . $phpThumb->cache_filename . ')', __FILE__, __LINE__);
        }
    } else {
        if (headers_sent()) {
            $phpThumb->ErrorImage('Headers already sent (' . basename(__FILE__) . ' line ' . __LINE__ . ')');
            exit;
        }
        SendSaveAsFileHeaderIfNeeded();
        header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $nModified) . ' GMT');
        if (@$_SERVER['HTTP_IF_MODIFIED_SINCE'] && $nModified == strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) && @$_SERVER['SERVER_PROTOCOL']) {
            header($_SERVER['SERVER_PROTOCOL'] . ' 304 Not Modified');
            exit;
        }
        if ($getimagesize = @GetImageSize($phpThumb->cache_filename)) {
            header('Content-Type: ' . phpthumb_functions::ImageTypeToMIMEtype($getimagesize[2]));
        }
        if (!@$PHPTHUMB_CONFIG['cache_force_passthru'] && ereg('^' . preg_quote($nice_docroot) . '(.*)$', $nice_cachefile, $matches)) {
            header('Location: ' . dirname($matches[1]) . '/' . urlencode(basename($matches[1])));
        } else {
            @readfile($phpThumb->cache_filename);
        }
        exit;
    }
    return true;
}
开发者ID:BackupTheBerlios,项目名称:thinkedit-svn,代码行数:43,代码来源:phpThumb.php

示例10: GD2BMPstring

 function GD2BMPstring(&$gd_image)
 {
     $imageX = ImageSX($gd_image);
     $imageY = ImageSY($gd_image);
     $BMP = '';
     for ($y = $imageY - 1; $y >= 0; $y--) {
         $thisline = '';
         for ($x = 0; $x < $imageX; $x++) {
             $argb = phpthumb_functions::GetPixelColor($gd_image, $x, $y);
             $thisline .= chr($argb['blue']) . chr($argb['green']) . chr($argb['red']);
         }
         while (strlen($thisline) % 4) {
             $thisline .= "";
         }
         $BMP .= $thisline;
     }
     $bmpSize = strlen($BMP) + 14 + 40;
     // BITMAPFILEHEADER [14 bytes] - http://msdn.microsoft.com/library/en-us/gdi/bitmaps_62uq.asp
     $BITMAPFILEHEADER = 'BM';
     // WORD    bfType;
     $BITMAPFILEHEADER .= phpthumb_functions::LittleEndian2String($bmpSize, 4);
     // DWORD   bfSize;
     $BITMAPFILEHEADER .= phpthumb_functions::LittleEndian2String(0, 2);
     // WORD    bfReserved1;
     $BITMAPFILEHEADER .= phpthumb_functions::LittleEndian2String(0, 2);
     // WORD    bfReserved2;
     $BITMAPFILEHEADER .= phpthumb_functions::LittleEndian2String(54, 4);
     // DWORD   bfOffBits;
     // BITMAPINFOHEADER - [40 bytes] http://msdn.microsoft.com/library/en-us/gdi/bitmaps_1rw2.asp
     $BITMAPINFOHEADER = phpthumb_functions::LittleEndian2String(40, 4);
     // DWORD  biSize;
     $BITMAPINFOHEADER .= phpthumb_functions::LittleEndian2String($imageX, 4);
     // LONG   biWidth;
     $BITMAPINFOHEADER .= phpthumb_functions::LittleEndian2String($imageY, 4);
     // LONG   biHeight;
     $BITMAPINFOHEADER .= phpthumb_functions::LittleEndian2String(1, 2);
     // WORD   biPlanes;
     $BITMAPINFOHEADER .= phpthumb_functions::LittleEndian2String(24, 2);
     // WORD   biBitCount;
     $BITMAPINFOHEADER .= phpthumb_functions::LittleEndian2String(0, 4);
     // DWORD  biCompression;
     $BITMAPINFOHEADER .= phpthumb_functions::LittleEndian2String(0, 4);
     // DWORD  biSizeImage;
     $BITMAPINFOHEADER .= phpthumb_functions::LittleEndian2String(2835, 4);
     // LONG   biXPelsPerMeter;
     $BITMAPINFOHEADER .= phpthumb_functions::LittleEndian2String(2835, 4);
     // LONG   biYPelsPerMeter;
     $BITMAPINFOHEADER .= phpthumb_functions::LittleEndian2String(0, 4);
     // DWORD  biClrUsed;
     $BITMAPINFOHEADER .= phpthumb_functions::LittleEndian2String(0, 4);
     // DWORD  biClrImportant;
     return $BITMAPFILEHEADER . $BITMAPINFOHEADER . $BMP;
 }
开发者ID:myindexlike,项目名称:MODX.snippets,代码行数:53,代码来源:phpthumb.bmp.php

示例11: ImageResizeFunction

 function ImageResizeFunction(&$dst_im, &$src_im, $dstX, $dstY, $srcX, $srcY, $dstW, $dstH, $srcW, $srcH)
 {
     $this->DebugMessage('ImageResizeFunction($o, $s, ' . $dstX . ', ' . $dstY . ', ' . $srcX . ', ' . $srcY . ', ' . $dstW . ', ' . $dstH . ', ' . $srcW . ', ' . $srcH . ')', __FILE__, __LINE__);
     if ($dstW == $srcW && $dstH == $srcH) {
         return ImageCopy($dst_im, $src_im, $dstX, $dstY, $srcX, $srcY, $srcW, $srcH);
     }
     if (phpthumb_functions::gd_version() >= 2.0) {
         if ($this->config_disable_imagecopyresampled) {
             return phpthumb_functions::ImageCopyResampleBicubic($dst_im, $src_im, $dstX, $dstY, $srcX, $srcY, $dstW, $dstH, $srcW, $srcH);
         }
         return ImageCopyResampled($dst_im, $src_im, $dstX, $dstY, $srcX, $srcY, $dstW, $dstH, $srcW, $srcH);
     }
     return ImageCopyResized($dst_im, $src_im, $dstX, $dstY, $srcX, $srcY, $dstW, $dstH, $srcW, $srcH);
 }
开发者ID:notzen,项目名称:exponent-cms,代码行数:14,代码来源:phpthumb.class.php

示例12: array

}
////////////////////////////////////////////////////////////////
// check to see if file can be output from source with no processing or caching
$CanPassThroughDirectly = true;
$FilenameParameters = array('h', 'w', 'sx', 'sy', 'sw', 'sh', 'bw', 'brx', 'bry', 'bg', 'bgt', 'bc', 'usa', 'usr', 'ust', 'wmf', 'wmp', 'wmm', 'wma', 'xto', 'ra', 'ar', 'iar', 'maxb');
foreach ($FilenameParameters as $key) {
    if (isset($_REQUEST[$key])) {
        $CanPassThroughDirectly = false;
        break;
    }
}
if ($CanPassThroughDirectly && !empty($_REQUEST['src'])) {
    // no parameters set, passthru
    $SourceFilename = $phpThumb->ResolveFilenameToAbsolute($_REQUEST['src']);
    if ($getimagesize = @GetImageSize($SourceFilename)) {
        header('Content-type: ' . phpthumb_functions::ImageTypeToMIMEtype($getimagesize[2]));
        @readfile($SourceFilename);
        exit;
    }
}
// check to see if file already exists in cache, and output it with no processing if it does
if (!empty($phpThumb->config_cache_directory) && empty($_REQUEST['phpThumbDebug'])) {
    $cache_filename = $phpThumb->GenerateCachedFilename();
    if (is_file($cache_filename)) {
        header('Content-type: image/' . $phpThumb->thumbnailFormat);
        @readfile($cache_filename);
        exit;
    }
}
////////////////////////////////////////////////////////////////
// You may want to pull data from a database rather than a physical file
开发者ID:BackupTheBerlios,项目名称:ydframework-svn,代码行数:31,代码来源:phpThumb.php

示例13: scanMusicFileTags

 public function scanMusicFileTags()
 {
     # TODO: handle orphaned records
     # TODO: displaying itemsChecked / itemsProcessed is incorrect
     # TODO: which speed-calculation makes sense? itemsChecked/minutute or itemsProcessed/minute or both?
     $this->jobPhase = 2;
     $this->beginJob(array('msg' => 'collecting tracks to scan from mysql database'), __FUNCTION__);
     $app = \Slim\Slim::getInstance();
     $phpThumb = Bitmap::getPhpThumb();
     $phpThumb->setParameter('config_cache_directory', APP_ROOT . 'embedded');
     $getID3 = new \getID3();
     // make sure that a single directory will not be scanned twice
     $scannedDirectories = array();
     // get timestamps of all images from mysql database
     $imageTimestampsMysql = array();
     ////////////////////////////////////////////////////////////////
     // TEMP reset database status for testing purposes
     #$query = "UPDATE rawtagdata SET importStatus=1, lastScan=0;";
     #$app->db->query($query);
     #$query = "DELETE FROM bitmap WHERE trackId > 0;";
     #$app->db->query($query);
     ////////////////////////////////////////////////////////////////
     if ($app->config['images']['look_cover_directory'] == TRUE) {
         $this->pluralizeCommonArtworkDirectoryNames($app->config['images']['common_artwork_dir_names']);
     }
     $query = "\n\t\t\tSELECT COUNT(*) AS itemCountTotal\n\t\t\tFROM rawtagdata WHERE lastScan < filemtime";
     $this->itemCountTotal = (int) $app->db->query($query)->fetch_assoc()['itemCountTotal'];
     $query = "\n\t\t\tSELECT id,\n\t\t\t\trelativePath, relativePathHash, filemtime,\n\t\t\t\trelativeDirectoryPath, relativeDirectoryPathHash, directoryMtime \n\t\t\tFROM rawtagdata \n\t\t\tWHERE lastScan < filemtime";
     // LIMIT 200000,1000;";
     $result = $app->db->query($query);
     $extractedImages = 0;
     while ($record = $result->fetch_assoc()) {
         $this->itemCountChecked++;
         cliLog($record['id'] . ' ' . $record['relativePath'], 2);
         $this->updateJob(array('msg' => 'processed ' . $this->itemCountChecked . ' files', 'currentItem' => $record['relativePath'], 'extractedImages' => $extractedImages));
         $t = new Rawtagdata();
         $t->setId($record['id']);
         $t->setLastScan(time());
         $t->setImportStatus(2);
         // TODO: handle not found files
         if (is_file($app->config['mpd']['musicdir'] . $record['relativePath']) === TRUE) {
             $t->setFilesize(filesize($app->config['mpd']['musicdir'] . $record['relativePath']));
         } else {
             $t->setError('invalid file');
             $t->update();
             continue;
         }
         // skip very large files
         // TODO: how to handle this?
         if ($t->getFilesize() > 1000000000) {
             $t->setError('invalid filesize ' . $t->getFilesize() . ' bytes');
             $t->update();
             continue;
         }
         $tagData = $getID3->analyze($app->config['mpd']['musicdir'] . $record['relativePath']);
         \getid3_lib::CopyTagsToComments($tagData);
         $this->mapTagsToRawtagdataInstance($t, $tagData);
         $t->update();
         if (!$app->config['images']['read_embedded']) {
             continue;
         }
         if (isset($tagData['comments']['picture']) === FALSE) {
             continue;
         }
         if (is_array($tagData['comments']['picture']) === FALSE) {
             continue;
         }
         // loop through all embedded images
         foreach ($tagData['comments']['picture'] as $bitmapIndex => $bitmapData) {
             if (isset($bitmapData['image_mime']) === FALSE) {
                 // skip unspecifyable datachunk
                 continue;
             }
             if (isset($bitmapData['data']) === FALSE) {
                 // skip missing datachunk
                 continue;
             }
             $rawImageData = $bitmapData['data'];
             if (strlen($rawImageData) < 20) {
                 // skip obviously invalid imagedata
                 continue;
             }
             if (strlen($rawImageData) > 40000) {
                 // skip huge imagedata
                 // got errormessage "Maximum supported image dimension is 65500 pixels" from ???
                 continue;
             }
             # TODO: delete tmp files of php thumb - shouldn't phpThumb handle that itself?
             $phpThumb->resetObject();
             $phpThumb->setSourceData($rawImageData);
             $phpThumb->setParameter('config_cache_prefix', $record['relativePathHash'] . '_' . $bitmapIndex . '_');
             $phpThumb->SetCacheFilename();
             $phpThumb->GenerateThumbnail();
             \phpthumb_functions::EnsureDirectoryExists(dirname($phpThumb->cache_filename));
             $phpThumb->RenderToFile($phpThumb->cache_filename);
             $extractedImages++;
             if (is_file($phpThumb->cache_filename) === FALSE) {
                 // there had been an error
                 // TODO: how to handle this?
                 continue;
//.........这里部分代码省略.........
开发者ID:daskleinesys,项目名称:slimpd,代码行数:101,代码来源:main.php

示例14: exif_info

 function exif_info()
 {
     static $exif_info = array();
     if (empty($exif_info)) {
         // based on code by johnschaefer at gmx dot de
         // from PHP help on gd_info()
         $exif_info = array('EXIF Support' => '', 'EXIF Version' => '', 'Supported EXIF Version' => '', 'Supported filetypes' => '');
         $phpinfo_array = phpthumb_functions::phpinfo_array();
         foreach ($phpinfo_array as $line) {
             $line = trim(strip_tags($line));
             foreach ($exif_info as $key => $value) {
                 if (strpos($line, $key) === 0) {
                     $newvalue = trim(str_replace($key, '', $line));
                     $exif_info[$key] = $newvalue;
                 }
             }
         }
     }
     return $exif_info;
 }
开发者ID:BackupTheBerlios,项目名称:ydframework-svn,代码行数:20,代码来源:phpthumb.functions.php

示例15: gd_missing

function gd_missing()
{
    require_once PLOGGER_DIR . '/plog-includes/lib/phpthumb/phpthumb.functions.php';
    // This is copied over from phpthumb
    return phpthumb_functions::gd_version() < 1;
}
开发者ID:joshuasiler,项目名称:Rebuilding-Together,代码行数:6,代码来源:install-functions.php


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