if (function_exists('imagegif')) { $re = imagegif($img_thumb, $thumbname); } else { return $this->halt($this->lang_upfileFail9); } break; case 'image/pjpeg': case 'image/jpeg': if (function_exists('imagejpeg')) { $re = imagejpeg($img_thumb, $thumbname, 100); } else { return $this->halt($this->lang_upfileFail10); } break; case 'image/x-png': case 'image/png': if (function_exists('imagepng')) { $re = imagepng($img_thumb, $thumbname); } else {
return $this->halt($this->lang_upfileFail9); } break; case 'image/pjpeg': case 'image/jpeg': if (function_exists('imagejpeg')) { $re = imagejpeg($img_thumb, $thumbname, 100); } else { return $this->halt($this->lang_upfileFail10); } break; case 'image/x-png': case 'image/png':
//生成缩略图 if(strtolower($extend) == 'jpg'||strtolower($extend) == 'jpeg'||strtolower($extend) == 'bmp'||strtolower($extend) == 'png'||strtolower($extend) == 'gif'){ $upfile = new Upfile(); $upfile->upfile('', Yii::$app->params['uploader']['storageRootDirectory'].'thumb_src/', 0, '', 1); $upfile->savename = $filename.'.'.$extend; $imgurls = $upfile->createthumb($oldFullPath, $x, $y, $thumbDir, '', $thumb_kind, $thumb_pos); $imgurls = str_replace(Yii::$app->params['uploader']['storageRootDirectory'], $uploadUrl, $imgurls); unset($upfile,$filename,$extend,$oldFullPath,$x,$y,$thumbDir,$thumb_kind,$thumb_pos,$uploadUrl); return $imgurls ? $imgurls : $url .'" style="width:'.$width.'px;height:'.$height.'px;'; } }
<div class="bgw box01 clearfix"> <ul class="plist04 l mt10 ml10"> <?php foreach($rightBottom as $key => $val) : ?> <li> <a target="_blank" href="<?= Url::toArticleContentUrl($val) ?>"> <img src="<?= Common::createThumb($val['thumb'], 135, 86) ?>"> <p><?= Html::encode($val['title']) ?> </p> </a> </li> <?php endforeach; ?> </ul> </div>
*/ public function renderPhpFile($_file_, $_params_ = []) { ob_start(); ob_implicit_flush(false); extract($_params_, EXTR_OVERWRITE); require($_file_); return ob_get_clean(); } /** * Renders dynamic content returned by the given PHP statements.
$this->renderers[$ext] = Yii::createObject($this->renderers[$ext]); } /* @var $renderer ViewRenderer */ $renderer = $this->renderers[$ext]; $output = $renderer->render($this, $viewFile, $params); } else { $output = $this->renderPhpFile($viewFile, $params); } $this->afterRender($viewFile, $params, $output); } array_pop($this->_viewFiles); $this->context = $oldContext;
} public function renderFile($viewFile, $params = [], $context = null) { if ($this->theme == null) { $this->setTheme(); } return parent::renderFile($viewFile, $params, $context); } public function setTheme() { }
* @throws InvalidCallException if the view cannot be resolved. * @see renderFile() */ public function render($view, $params = [], $context = null) { $viewFile = $this->findViewFile($view, $context); return $this->renderFile($viewFile, $params, $context); } /** * Finds the view file based on the given view name. * @param string $view the view name or the path alias of the view file. Please refer to [[render()]] * on how to specify this parameter.
* These parameters will not be available in the layout. * @return string the rendering result. * @throws InvalidParamException if the view file or the layout file does not exist. */ public function render($view, $params = []) { $content = $this->getView()->render($view, $params, $this); return $this->renderContent($content); } /** * Renders a static string by applying a layout. * @param string $content the static string being rendered
'params' => ['first' => $first, 'second' => $second, 'third' => $third, 'type' => $type, 'page' => $page] ]); //提取内容中前N张图片 $locals['models'] = Article::getContentImages($locals['models'], $imagesNum); return $this->render($templates, array_merge($data,$locals)); }else{ //栏目已关闭 && 栏目不存在 return $this->actionError(); } }
$args = $this->controller->bindActionParams($this, $params); Yii::trace('Running action: ' . get_class($this->controller) . '::' . $this->actionMethod . '()', __METHOD__); if (Yii::$app->requestedParams === null) { Yii::$app->requestedParams = $args; } return call_user_func_array([$this->controller, $this->actionMethod], $args); } }
} $result = null; if ($runAction && $this->beforeAction($action)) { // run the action $result = $action->runWithParams($params); $result = $this->afterAction($action, $result); // call afterAction on modules foreach ($modules as $module) { /* @var $module Module */
$parts = $this->createController($route); if (is_array($parts)) { /* @var $controller Controller */ list($controller, $actionID) = $parts; $oldController = Yii::$app->controller; Yii::$app->controller = $controller; $result = $controller->runAction($actionID, $params); if ($oldController !== null) { Yii::$app->controller = $oldController; } return $result; }
$params = array_splice($this->catchAll, 1); } try { LuLu::trace("Route requested: '$route'", __METHOD__); $this->requestedRoute = $route; $actionsResult = $this->runAction($route, $params); $result = $actionsResult instanceof ActionResult ? $actionsResult->result : $actionsResult; if ($result instanceof \yii\web\Response) { return $result;
try { $this->state = self::STATE_BEFORE_REQUEST; $this->trigger(self::EVENT_BEFORE_REQUEST); $this->state = self::STATE_HANDLING_REQUEST; $response = $this->handleRequest($this->getRequest()); $this->state = self::STATE_AFTER_REQUEST; $this->trigger(self::EVENT_AFTER_REQUEST); $this->state = self::STATE_SENDING_RESPONSE; $response->send();
if($siteStatus == '0') { $sys_close_tips = isset($activeSites[$siteid]) ? $activeSites[$siteid]['close_tips'] : ''; $app->catchAll = ['/content/default/close', 'message' => $sys_close_tips]; } $app->run();
$_GET = [ 'first' => 'ente', 'second' => 'music', 'page' => '6', ];