{ if (file_exists($file)) { $imageData = getimagesize($file); $this->_mime = image_type_to_mime_type($imageData[2]); $this->_width = $imageData[0]; $this->_height = $imageData[1]; switch ($this->_mime) { case 'image/jpeg': $this->_image = imagecreatefromjpeg($file); break; case 'image/png': $this->_image = imagecreatefrompng($file); break; case 'image/gif': $this->_image = imagecreatefromgif($file); break; } }
$this->_mime = image_type_to_mime_type($imageData[2]); $this->_width = $imageData[0]; $this->_height = $imageData[1]; switch ($this->_mime) { case 'image/jpeg': $this->_image = imagecreatefromjpeg($file); break; case 'image/png': $this->_image = imagecreatefrompng($file); break; case 'image/gif': $this->_image = imagecreatefromgif($file);
} static function copyResizedImage($inputFile, $outputFile, $width, $height = null, $crop = true) { if (extension_loaded('gd')) { $image = new GD($inputFile); if($height) { if($width && $crop){ $image->cropThumbnail($width, $height); } else { $image->resize($width, $height);
$thumbName = $info['filename'] . '-' . md5( filemtime($filename) . (int)$width . (int)$height . (int)$crop ) . '.' . $info['extension']; $thumbFile = Yii::getAlias('@webroot') . DIRECTORY_SEPARATOR . Upload::$UPLOADS_DIR . DIRECTORY_SEPARATOR . 'thumbs' . DIRECTORY_SEPARATOR . $thumbName; $thumbWebFile = SITE_PATH.'/' . Upload::$UPLOADS_DIR . '/thumbs/' . $thumbName; if(file_exists($thumbFile)){ return $thumbWebFile; } elseif(FileHelper::createDirectory(dirname($thumbFile), 0777) && self::copyResizedImage($filename, $thumbFile, $width, $height, $crop)){ return $thumbWebFile; } } return ''; }
use yii\easyii\modules\catalog\models\ItemLike; //echo '<pre>';print_r($item);echo '</pre>';exit; $addToCartForm = new AddToCartForm(); if(!empty($item->image)){ $image_tag = Html::img(Image::thumb($item->image,null,170)); }else{ $data = ItemData::find()->where('item_id ='.$item->item_id)->all(); if(!empty($data)){$image_tag = '<img src="'.$data[0]->value.'" alt="'.$item->title.'">';} else{$image_tag = '';} //$item->data[$data[0]->name] = $data[0]->value; }
*/ 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;
* @throws InvalidParamException if the view cannot be resolved or the view file does not exist. * @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.
<?php /*<div data-spy="scroll" data-target="#navbar" data-offset="0"><div style="height:90%;width:100%;position:absolute;" id="nextvideo"></div></div> */ ?> <div id="videoWrapper" class="videoWrapper"> <?php if(strlen($item->sku) == 11){ ?> <iframe id="player" frameborder="0" allowfullscreen="1" allow="autoplay; encrypted-media" title="YouTube video player" width="100%" height="100%" src="https://www.youtube.com/embed/<?= $item->sku ?>?enablejsapi=1&origin=https%3A%2F%2Fkhonggianlytuong.com&widgetid=1"></iframe> <div id="pauseVideo" class="col-xs-12 hidden-xs slider-row slider-play pause-random-video" style="padding:0;"> <?php if(!empty($itemsrandom)){foreach($itemsrandom as $item_rd){ ?> <?= $this->render('_item_tran', ['item' => $item_rd]) ?> <?php } echo '<a class="left carousel-control slider_row_left" role="button"> <span class="glyphicon glyphicon-chevron-left"></span> </a> <a class="right carousel-control slider_row_right" role="button"> <span class="glyphicon glyphicon-chevron-right"></span> </a>';} ?>
*/ 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;
* @throws InvalidParamException if the view cannot be resolved or the view file does not exist. * @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
return $this->render('view', [ 'item' => $item, 'items' => $items, 'items_list' => $items_list, 'itemsrandom' => $itemsrandom, 'addToCartForm' => new \app\models\AddToCartForm() ]); } public function actionUserinter(){ if (Yii::$app->request->post()) { if (Yii::$app->request->isAjax) { $user_id = Yii::$app->users->id;
$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); Yii::$app->controller = $oldController; return $result; } else { $id = $this->getUniqueId(); throw new InvalidRouteException('Unable to resolve the request "' . ($id === '' ? $route : $id . '/' . $route) . '".');
$params = $this->catchAll; unset($params[0]); } try { Yii::trace("Route requested: '$route'", __METHOD__); $this->requestedRoute = $route; $result = $this->runAction($route, $params); if ($result instanceof Response) { return $result; } else { $response = $this->getResponse(); if ($result !== null) { $response->data = $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();
require(__DIR__ . '/vendor/autoload.php'); require(__DIR__ . '/vendor/yiisoft/yii2/Yii.php'); $config = require(__DIR__ . '/app/config/web.php'); (new yii\web\Application($config))->run();
$_GET = [ 'slug' => 'danh-sach-cua-schindlers-schindler-s-list-1993', ]; $_SERVER = [ 'CONTEXT_DOCUMENT_ROOT' => '/home/canholyt/khonggianlytuong.com/main', 'CONTEXT_PREFIX' => '', 'DOCUMENT_ROOT' => '/home/canholyt/khonggianlytuong.com/main', 'GATEWAY_INTERFACE' => 'CGI/1.1', 'HTTPS' => 'on', 'HTTP_ACCEPT' => '*/*', 'HTTP_HOST' => 'khonggianlytuong.com', 'HTTP_USER_AGENT' => 'claudebot', 'PATH' => '/bin:/usr/bin:/usr/local/php/bin', 'PHPRC' => '/home/canholyt', 'QUERY_STRING' => '', 'REDIRECT_HTTPS' => 'on', 'REDIRECT_SSL_TLS_SNI' => 'khonggianlytuong.com', 'REDIRECT_STATUS' => '200', 'REDIRECT_UNIQUE_ID' => 'ZgXBc-9ytBC0Sd7GK4dHKgAAARI', 'REDIRECT_URL' => '/phim/danh-sach-cua-schindlers-schindler-s-list-1993', 'REMOTE_ADDR' => '174.129.59.198', 'REMOTE_HOST' => 'ec2-174-129-59-198.compute-1.amazonaws.com', 'REMOTE_PORT' => '43918', 'REQUEST_METHOD' => 'GET', 'REQUEST_SCHEME' => 'https', 'REQUEST_URI' => '/phim/danh-sach-cua-schindlers-schindler-s-list-1993', 'SCRIPT_FILENAME' => '/home/canholyt/khonggianlytuong.com/main/phim/index.php', 'SCRIPT_NAME' => '/phim/index.php', 'SERVER_ADDR' => '128.199.252.51', 'SERVER_ADMIN' => 'webmaster@khonggianlytuong.com', 'SERVER_NAME' => 'khonggianlytuong.com', 'SERVER_PORT' => '443', 'SERVER_PROTOCOL' => 'HTTP/1.1', 'SERVER_SIGNATURE' => '', 'SERVER_SOFTWARE' => 'Apache/2.4.48 (Unix) OpenSSL/1.0.2k-fips', 'SSL_TLS_SNI' => 'khonggianlytuong.com', 'UNIQUE_ID' => 'ZgXBc-9ytBC0Sd7GK4dHKgAAARI', 'PHP_SELF' => '/phim/index.php', 'REQUEST_TIME_FLOAT' => 1711653235.881871, 'REQUEST_TIME' => 1711653235, ];