{ $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)) {
} $scale = max($width / $info['width'], $height / $info['height']); $x = round(($info['width'] * $scale - $width) / 2); $y = round(($info['height'] * $scale - $height) / 2); Image::thumbnail($source, round($info['width'] * $scale), round($info['height'] * $scale))->save($source, ['quality' => 100]); Image::crop($source, $width, $height, [$x,$y])->save($source, ['quality' => 100]); if($watermark == false) { self::convertWebp($source); } }
if (file_exists($checkTargetFile)) { return $targetFile; } else { copy(WEB_ROOT.$file, $targetFile); 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 (!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 != '') { $img = $this->image; } else { $img = '../no-product-pic.jpg'; } return Yii::$app->imagecache->createUrl(9, Yii::$app->params['productscategoryPictures'] . $img); } public function getIconpic() { if ($this->icon != '') { return Yii::$app->params['productscategoryIcon'] . $this->icon;
*/ 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;
$dataProvider->pagination->defaultPageSize = 999; //$dataProvider->pagination->pageParam='oldal'; Meta::renderMeta([ 'title'=>($model->meta_title!="")?$model->meta_title:extra::getIntro($model->title,50), 'description'=>($model->meta_description!="")?$model->meta_description:extra::getIntro($model->description,310), 'image'=>$model->ogthumb, 'og_url'=>$model->url ]); $this->view->params['mainCategory'] = $model->getTopLevelCategoryId(); return $this->render('view', [
$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();
$_GET = [ 'page' => '', 'id' => 36, ]; $_SESSION = [ '__flash' => [], ];