{ $loader = $path instanceof LoaderInterface ? $path : $this->getClassFactory()->createFileLoader($path); $path = $loader->getPath(); $data = $loader->getData(); $resource = $this->createImageFromString($data); if (!\is_resource($resource)) { throw new RuntimeException(sprintf('Unable to open image %s', $path)); } return $this->wrap($resource, new RGB(), $this->getMetadataReader()->readFile($loader)); } /** * {@inheritdoc} * * @see \Imagine\Image\ImagineInterface::load()
if (is_resource($image)) { return static::getImagine()->read($image); } if (is_string($image)) { return static::getImagine()->open(Yii::getAlias($image)); } throw new InvalidParamException('File should be either ImageInterface, resource or a string containing file path.'); } /**
* @param int $height the height in pixels to create the thumbnail * @param string $mode mode of resizing original image to use in case both width and height specified * @return ImageInterface */ public static function thumbnail($image, $width, $height, $mode = ManipulatorInterface::THUMBNAIL_OUTBOUND) { $img = self::ensureImageInterfaceInstance($image); /** @var BoxInterface $sourceBox */ $sourceBox = $img->getSize(); $thumbnailBox = static::getThumbnailBox($sourceBox, $width, $height); if (self::isUpscaling($sourceBox, $thumbnailBox)) {
} else { $height = (int)min($height, $info['height']); $width = (int)round($height / $aspect); } Image::thumbnail($source,$width, $height)->save($source, ['quality' => 100]); if($watermark == false) { self::convertWebp($source); } }
switch($present->action) { case Imagecache::ACTION_RESIZE_CORP: $this->scaleAndCrop($targetFile, $present->width, $present->height, ($present->watermark!=0)); break; case Imagecache::ACTION_FIX_WIDTH: $this->resize($targetFile, $present->width, 99999, ($present->watermark!=0)); break; case Imagecache::ACTION_FIX_HIGHT: $this->resize($targetFile, 99999, $present->height, ($present->watermark!=0)); break; case Imagecache::ACTION_RESIZE: $this->resize($targetFile, $present->width, $present->height, ($present->watermark!=0)); break; } if($present->watermark!=0) { $wtm=Imagecachewatermark::findOne($present->watermark);
if (!is_file(WEB_ROOT.$file)) return false; $this->preset=Imagecache::findOne($icid); if (!empty($this->preset)) { $generatedPath = $this->createPath($icid, $file, $oldfile); $webrootPath = WEB_ROOT; if(strpos($generatedPath, $webrootPath) !== FALSE) { $generatedPath = substr($generatedPath, strlen($webrootPath)); } $generatedUrl = str_replace(['\\', $fileext], ['/', "webp"], $generatedPath);
if ($this->image != '' && file_exists(WEB_ROOT . Yii::$app->params['productscategoryPictures'] . $this->image)) { $img = $this->image; } else { $img = '../no-product-pic.jpg'; } return Yii::$app->imagecache->createUrl(8, Yii::$app->params['productscategoryPictures'] . $img); } public function getThumbxl() { if ($this->image != '' && file_exists(WEB_ROOT . Yii::$app->params['productscategoryPictures'] . $this->image)) { $img = $this->image;
*/ public function __get($name) { $getter = 'get' . $name; if (method_exists($this, $getter)) { // read property, e.g. getName() return $this->$getter(); } // behavior property $this->ensureBehaviors(); foreach ($this->_behaviors as $behavior) { if ($behavior->canGetProperty($name)) {
return null; } if (isset($this->_related[$name]) || array_key_exists($name, $this->_related)) { return $this->_related[$name]; } $value = parent::__get($name); if ($value instanceof ActiveQueryInterface) { $this->setRelationDependencies($name, $value); return $this->_related[$name] = $value->findFor($name, $this); } return $value;
<?php $i = 0; foreach($categories as $cat) { ?> <a href="<?= $cat->url ?>" class="category <?= $i >= 9 ? 'd-none' : 'd-flex' ?> flex-column justify-content-start align-items-center"> <div class="img"> <img src="<?= $cat->thumb ?>" alt="<?= $cat->title ?>" title="<?= $cat->title ?>"/> </div> <span class="category-text"><?= $cat->title ?></span> </a> <?php $i++; }
{ $_obInitialLevel_ = ob_get_level(); ob_start(); ob_implicit_flush(false); extract($_params_, EXTR_OVERWRITE); try { require $_file_; return ob_get_clean(); } catch (\Exception $e) { while (ob_get_level() > $_obInitialLevel_) { if (!@ob_end_clean()) { ob_clean(); }
$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 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](guide:concept-aliases) 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 InvalidArgumentException 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
// \app\components\extra::e($dataProvider->query->createCommand()->getRawSql()); return $this->render('index', [ 'categories' => $categories, 'searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'kategoria' => $kategoria, ]); } public function actionView($id) { $model = $this->findModel($id);
$args = $this->controller->bindActionParams($this, $params); Yii::debug('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 = $this->catchAll; unset($params[0]); } try { Yii::debug("Route requested: '$route'", __METHOD__); $this->requestedRoute = $route; $result = $this->runAction($route, $params); if ($result instanceof Response) { return $result; } $response = $this->getResponse(); if ($result !== null) {
{ 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__ . '/config/web.php'); (new yii\web\Application($config))->run();
$_SESSION = [ '__flash' => [], ];