本文整理汇总了PHP中timthumb类的典型用法代码示例。如果您正苦于以下问题:PHP timthumb类的具体用法?PHP timthumb怎么用?PHP timthumb使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了timthumb类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: images
function images()
{
ini_set('memory_limit', '128M');
require 'include/cypher.class.php';
require 'include/timthumb/timthumb.class.php';
$ecode_str = base64_decode(str_replace(preg_split('~~u', '-_,', null, PREG_SPLIT_NO_EMPTY), preg_split('~~u', '+/=', null, PREG_SPLIT_NO_EMPTY), $this->args[0]));
$cypher = new Cypher();
$cypher->key = Core::inst()->img_password;
$images_param['src'] = '../view/upload/images/' . $cypher->decrypt(mb_substr($ecode_str, mb_strlen(Core::inst()->img_prefix, 'UTF-8') - mb_strlen($ecode_str, 'UTF-8')));
$this('db')->query('SELECT * FROM `di.album_gallery`, `di.album_photo` WHERE `di.album_gallery`.`album_gallery_id` = `di.album_photo`.`album_photo_gallery_id` AND `di.album_photo`.`album_photo_name` = ? AND `di.album_gallery`.`album_gallery_visible` = 1;', $cypher->decrypt(mb_substr($ecode_str, mb_strlen(Core::inst()->img_prefix, 'UTF-8') - mb_strlen($ecode_str, 'UTF-8'))));
if ($this('db')->affected_rows() == 0) {
exit(0);
}
if (isset($this->args[1]) && $this->args[1] != 0) {
$images_param['w'] = $this->args[1];
}
if (isset($this->args[2]) && $this->args[2] != 0) {
$images_param['h'] = $this->args[2];
}
$images_param['q'] = 100;
timthumb::start($images_param);
}
开发者ID:gorodok11,项目名称:di_gallery,代码行数:22,代码来源:viewController.php
示例2: getURL
protected function getURL($url, $tempfile)
{
$this->lastURLError = false;
$url = preg_replace('/ /', '%20', $url);
if (function_exists('curl_init')) {
$this->debug(3, "Curl is installed so using it to fetch URL.");
self::$curlFH = fopen($tempfile, 'w');
if (!self::$curlFH) {
$this->error("Could not open {$tempfile} for writing.");
return false;
}
self::$curlDataWritten = 0;
$this->debug(3, "Fetching url with curl: {$url}");
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_TIMEOUT, CURL_TIMEOUT);
curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.122 Safari/534.30");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_WRITEFUNCTION, 'timthumb::curlWrite');
@curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
@curl_setopt($curl, CURLOPT_MAXREDIRS, 10);
$curlResult = curl_exec($curl);
fclose(self::$curlFH);
$httpStatus = curl_getinfo($curl, CURLINFO_HTTP_CODE);
if ($httpStatus == 404) {
$this->set404();
}
if ($httpStatus == 302) {
$this->error("External Image is Redirecting. Try alternate image url");
return false;
}
if ($curlResult) {
curl_close($curl);
return true;
} else {
$this->lastURLError = curl_error($curl);
curl_close($curl);
return false;
}
} else {
$img = @file_get_contents($url);
if ($img === false) {
$err = error_get_last();
if (is_array($err) && $err['message']) {
$this->lastURLError = $err['message'];
} else {
$this->lastURLError = $err;
}
if (preg_match('/404/', $this->lastURLError)) {
$this->set404();
}
return false;
}
if (!file_put_contents($tempfile, $img)) {
$this->error("Could not write to {$tempfile}.");
return false;
}
return true;
}
}
开发者ID:sdgdsffdsfff,项目名称:shipin,代码行数:61,代码来源:timthumb.php
示例3: start
public static function start()
{
$tim = new timthumb();
$tim->handleErrors();
$tim->securityChecks();
if ($tim->tryBrowserCache()) {
exit(0);
}
$tim->handleErrors();
if (FILE_CACHE_ENABLED && $tim->tryServerCache()) {
exit(0);
}
$tim->handleErrors();
$tim->run();
$tim->handleErrors();
exit(0);
}
开发者ID:trabisdementia,项目名称:publisher,代码行数:17,代码来源:thumb.php
示例4: setMemoryLimit
/**
*
*/
protected function setMemoryLimit()
{
$inimem = ini_get('memory_limit');
$inibytes = timthumb::returnBytes($inimem);
$ourbytes = timthumb::returnBytes(static::$options['memory_limit']);
if ($inibytes < $ourbytes) {
ini_set('memory_limit', static::$options['memory_limit']);
$this->debug(3, "Increased memory from {$inimem} to " . static::$options['memory_limit']);
} else {
$this->debug(3, "Not adjusting memory size because the current setting is " . $inimem . " and our size of " . static::$options['memory_limit'] . " is smaller.");
}
}
开发者ID:johnstyle,项目名称:timthumb,代码行数:15,代码来源:Timthumb.php
示例5: setMemoryLimit
/**
* timthumb::setMemoryLimit()
*
* @return
*/
protected function setMemoryLimit()
{
$inimem = ini_get('memory_limit');
$inibytes = timthumb::returnBytes($inimem);
$ourbytes = timthumb::returnBytes(MEMORY_LIMIT);
if ($inibytes < $ourbytes) {
ini_set('memory_limit', MEMORY_LIMIT);
}
}
开发者ID:guyt101z,项目名称:MembershipMan,代码行数:14,代码来源:thumbmaker.php
示例6: renderImage
/**
*
* Render resized image
* @param string $image
* @param int $width
* @param int $height
* @return string image
*/
function renderImage($image, $width = 0, $height = 0)
{
if ($image) {
if ($this->params->get('thumbnailmode', 1)) {
$timthumb_params = array();
if (preg_match('/^https?:\\/\\/[^\\/]+/i', $image)) {
$timthumb_params['src'] = $image;
} else {
$timthumb_params['src'] = JURI::Base() . $image;
}
$timthumb_params['w'] = $width;
$timthumb_params['h'] = $height;
$timthumb_params['q'] = $this->params->get('imagequality', '90');
$timthumb_params['a'] = $this->params->get('alignment', 'c');
$timthumb_params['zc'] = $this->params->get('zoomcrop', '1');
if ($this->params->get('customfilters', '') != '') {
$timthumb_params['f'] = $this->params->get('customfilters', '');
} else {
$filters = $this->params->get('filters');
if (!empty($filters)) {
$filters = implode("|", $filters);
$timthumb_params['f'] = $filters;
}
}
$timthumb_params['s'] = $this->params->get('sharpen', '0');
$timthumb_params['cc'] = $this->params->get('canvascolour', 'FFFFFF');
$timthumb_params['ct'] = $this->params->get('canvastransparency', '1');
$tb_image = timthumb::start($timthumb_params);
// If can resize image -> return resized image, else keep original image
if (trim($tb_image) != '') {
$image = $tb_image;
}
return $image;
} else {
return $image;
}
} else {
return '';
}
}
开发者ID:vstorm83,项目名称:propertease,代码行数:48,代码来源:helper.php
注:本文中的timthumb类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论