本文整理汇总了PHP中phpthumb_functions::TranslateWHbyAngle方法的典型用法代码示例。如果您正苦于以下问题:PHP phpthumb_functions::TranslateWHbyAngle方法的具体用法?PHP phpthumb_functions::TranslateWHbyAngle怎么用?PHP phpthumb_functions::TranslateWHbyAngle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类phpthumb_functions
的用法示例。
在下文中一共展示了phpthumb_functions::TranslateWHbyAngle方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ImageMagickThumbnailToGD
//.........这里部分代码省略.........
}
} elseif ($this->sw || $this->sh || $this->sx || $this->sy) {
$crop_param = '';
$crop_param .= $this->sw ? $this->sw < 2 ? round($this->sw * $this->source_width) : $this->sw : $this->source_width;
$crop_param .= 'x' . ($this->sh ? $this->sh < 2 ? round($this->sh * $this->source_height) : $this->sh : $this->source_height);
$crop_param .= '+' . ($this->sx < 2 ? round($this->sx * $this->source_width) : $this->sx);
$crop_param .= '+' . ($this->sy < 2 ? round($this->sy * $this->source_height) : $this->sy);
// TO BE FIXED
// makes 1x1 output
// http://trainspotted.com/phpThumb/phpThumb.php?src=/content/CNR/47/CNR-4728-LD-L-20110723-898.jpg&w=100&h=100&far=1&f=png&fltr[]=lvl&sx=0.05&sy=0.25&sw=0.92&sh=0.42
// '/usr/bin/convert' -density 150 -thumbnail 100x100 -contrast-stretch '0.1%' '/var/www/vhosts/trainspotted.com/httpdocs/content/CNR/47/CNR-4728-LD-L-20110723-898.jpg[0]' png:'/var/www/vhosts/trainspotted.com/httpdocs/phpThumb/_cache/pThumbIIUlvj'
// $commandline .= ' -crop '.escapeshellarg($crop_param);
// this is broken for aoe=1, but unsure how to fix. Send advice to info@silisoftware.com
if ($this->w || $this->h) {
//if ($this->ImageMagickSwitchAvailable('repage')) {
if (false) {
// TO BE FIXED
// newer versions of ImageMagick require -repage <geometry>
$commandline .= ' -repage';
} else {
$this->DebugMessage('Skipping "-repage" because ImageMagick (v' . $this->ImageMagickVersion() . ') does not support it', __FILE__, __LINE__);
}
if ($IMuseExplicitImageOutputDimensions) {
if ($this->w && !$this->h) {
$this->h = ceil($this->w / ($this->source_width / $this->source_height));
} elseif ($this->h && !$this->w) {
$this->w = ceil($this->h * ($this->source_width / $this->source_height));
}
}
$commandline .= ' -' . $IMresizeParameter . ' ' . escapeshellarg($this->w . 'x' . $this->h);
}
} else {
if ($this->iar && intval($this->w) > 0 && intval($this->h) > 0) {
list($nw, $nh) = phpthumb_functions::TranslateWHbyAngle($this->w, $this->h, $this->ra);
$nw = round($nw) != 0 ? round($nw) : '';
$nh = round($nh) != 0 ? round($nh) : '';
$commandline .= ' -' . $IMresizeParameter . ' ' . escapeshellarg($nw . 'x' . $nh . '!');
} else {
$this->w = ($this->aoe || $this->far) && $this->w ? $this->w : ($this->w ? phpthumb_functions::nonempty_min($this->w, $getimagesize[0]) : '');
$this->h = ($this->aoe || $this->far) && $this->h ? $this->h : ($this->h ? phpthumb_functions::nonempty_min($this->h, $getimagesize[1]) : '');
if ($this->w || $this->h) {
if ($IMuseExplicitImageOutputDimensions) {
if ($this->w && !$this->h) {
$this->h = ceil($this->w / ($this->source_width / $this->source_height));
} elseif ($this->h && !$this->w) {
$this->w = ceil($this->h * ($this->source_width / $this->source_height));
}
}
list($nw, $nh) = phpthumb_functions::TranslateWHbyAngle($this->w, $this->h, $this->ra);
$nw = round($nw) != 0 ? round($nw) : '';
$nh = round($nh) != 0 ? round($nh) : '';
$commandline .= ' -' . $IMresizeParameter . ' ' . escapeshellarg($nw . 'x' . $nh);
}
}
}
}
} else {
$this->DebugMessage('GetImageSize(' . $this->sourceFilename . ') failed', __FILE__, __LINE__);
if ($this->w || $this->h) {
$exactDimensionsBang = $this->iar && intval($this->w) > 0 && intval($this->h) > 0 ? '!' : '';
if ($IMuseExplicitImageOutputDimensions) {
// unknown source aspect ratio, just put large number and hope IM figures it out
$commandline .= ' -' . $IMresizeParameter . ' ' . escapeshellarg(($this->w ? $this->w : '9999') . 'x' . ($this->h ? $this->h : '9999') . $exactDimensionsBang);
} else {
$commandline .= ' -' . $IMresizeParameter . ' ' . escapeshellarg($this->w . 'x' . $this->h . $exactDimensionsBang);
}
示例2: ImageMagickThumbnailToGD
//.........这里部分代码省略.........
break;
}
if ($wAll > 0 && $hAll > 0) {
$commandline .= ' -crop ' . $wAll . 'x' . $hAll . '+0+0';
} else {
$commandline .= ' -crop ' . $side . 'x' . $side . '+0+0';
}
if ($this->ImageMagickSwitchAvailable('repage')) {
$commandline .= ' +repage';
} else {
$this->DebugMessage('Skipping "+repage" because ImageMagick (v' . $this->ImageMagickVersion() . ') does not support it', __FILE__, __LINE__);
}
} elseif ($this->sw || $this->sh || $this->sx || $this->sy) {
$commandline .= ' -crop ' . ($this->sw ? $this->sw : $this->source_width) . 'x' . ($this->sh ? $this->sh : $this->source_height) . '+' . $this->sx . '+' . $this->sy;
// this is broken for aoe=1, but unsure how to fix. Send advice to info@silisoftware.com
if ($this->w || $this->h) {
if ($this->ImageMagickSwitchAvailable('repage')) {
$commandline .= ' -repage';
} else {
$this->DebugMessage('Skipping "-repage" because ImageMagick (v' . $this->ImageMagickVersion() . ') does not support it', __FILE__, __LINE__);
}
if ($IMuseExplicitImageOutputDimensions) {
if ($this->w && !$this->h) {
$this->h = ceil($this->w / ($this->source_width / $this->source_height));
} elseif ($this->h && !$this->w) {
$this->w = ceil($this->h * ($this->source_width / $this->source_height));
}
}
$commandline .= ' -' . $IMresizeParameter . ' ' . $this->w . 'x' . $this->h;
}
} else {
if ($this->iar && intval($this->w) > 0 && intval($this->h) > 0) {
//$commandline .= ' -'.$IMresizeParameter.' '.$this->w.'x'.$this->h.'!';
list($nw, $nh) = phpthumb_functions::TranslateWHbyAngle($this->w, $this->h, $this->ra);
$nw = round($nw) != 0 ? round($nw) : '';
$nh = round($nh) != 0 ? round($nh) : '';
$commandline .= ' -' . $IMresizeParameter . ' ' . $nw . 'x' . $nh . '!';
} else {
$this->w = ($this->aoe || $this->far) && $this->w ? $this->w : ($this->w ? phpthumb_functions::nonempty_min($this->w, $getimagesize[0]) : '');
$this->h = ($this->aoe || $this->far) && $this->h ? $this->h : ($this->h ? phpthumb_functions::nonempty_min($this->h, $getimagesize[1]) : '');
if ($this->w || $this->h) {
if ($IMuseExplicitImageOutputDimensions) {
if ($this->w && !$this->h) {
$this->h = ceil($this->w / ($this->source_width / $this->source_height));
} elseif ($this->h && !$this->w) {
$this->w = ceil($this->h * ($this->source_width / $this->source_height));
}
}
//$commandline .= ' -'.$IMresizeParameter.' '.$this->w.'x'.$this->h;
list($nw, $nh) = phpthumb_functions::TranslateWHbyAngle($this->w, $this->h, $this->ra);
$nw = round($nw) != 0 ? round($nw) : '';
$nh = round($nh) != 0 ? round($nh) : '';
$commandline .= ' -' . $IMresizeParameter . ' ' . $nw . 'x' . $nh;
}
}
}
}
} else {
$this->DebugMessage('GetImageSize(' . $this->sourceFilename . ') failed', __FILE__, __LINE__);
if ($this->w || $this->h) {
if ($IMuseExplicitImageOutputDimensions) {
// unknown source aspect ration, just put large number and hope IM figures it out
$commandline .= ' -' . $IMresizeParameter . ' ' . ($this->w ? $this->w : '9999') . 'x' . ($this->h ? $this->h : '9999');
} else {
$commandline .= ' -' . $IMresizeParameter . ' ' . $this->w . 'x' . $this->h;
}