當前位置: 首頁>>代碼示例>>PHP>>正文


PHP phpthumb_functions::TranslateWHbyAngle方法代碼示例

本文整理匯總了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);
                     }
開發者ID:notzen,項目名稱:exponent-cms,代碼行數:67,代碼來源:phpthumb.class.php

示例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;
                     }
開發者ID:CrazyBobik,項目名稱:allotaxi.test,代碼行數:67,代碼來源:phpthumb.class.php


注:本文中的phpthumb_functions::TranslateWHbyAngle方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。