当前位置: 首页>>代码示例>>PHP>>正文


PHP Point::of方法代码示例

本文整理汇总了PHP中Point::of方法的典型用法代码示例。如果您正苦于以下问题:PHP Point::of方法的具体用法?PHP Point::of怎么用?PHP Point::of使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Point的用法示例。


在下文中一共展示了Point::of方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: position

 /**
  * @return \Components\Point
  */
 public function position()
 {
     if (null === $this->m_position) {
         if (isset($this->initialized()->m_data['latitude']) && $this->m_data['longitude']) {
             $this->m_position = Point::of($this->m_data['latitude'], $this->m_data['longitude']);
         }
     }
     return $this->m_position;
 }
开发者ID:evalcodenet,项目名称:net.evalcode.components.i18n,代码行数:12,代码来源:location.php

示例2: render

 public function render($panel_ = null)
 {
     /* @var $value \Components\Io_Image */
     if (($value = $this->value()) && $value->exists()) {
         $image = $value;
         $height = (int) $this->attribute('height');
         $width = (int) $this->attribute('width');
         if ($width || $height) {
             $dimensions = $value->getDimensions();
             if (!$width) {
                 $width = round($dimensions->x / ($dimensions->y / $height));
             } else {
                 if (!$height) {
                     $height = round($dimensions->y / ($dimensions->x / $width));
                 }
             }
             if ($this->embedded) {
                 $image = Io_Image::valueOf(Environment::pathResource('ui', 'image', 'tmp', $width, $height, $value->getName()));
                 if (false === $image->exists()) {
                     $value->scale(Point::of($width, $height));
                     $value->saveAs($image);
                 }
             }
         }
         $this->attribute('width', $width);
         $this->attribute('height', $height);
         if ($this->embedded) {
             $this->attribute('src', sprintf('data:%s;base64,%s', $image->getMimetype(), $image->getBase64()));
         } else {
             $this->attribute('src', (string) Media_Scriptlet_Engine::imageUri('thumbnail', $image->getPath(), $width, $height));
         }
     } else {
         if (null !== $value && Debug::active()) {
             Log::debug('components/ui/panel/image', 'Image for given location does not exist [%s].', $value);
         }
     }
     return parent::render();
 }
开发者ID:evalcodenet,项目名称:net.evalcode.components.ui,代码行数:38,代码来源:image.php

示例3: dispatch

 /**
  * @param \Components\Http_Scriptlet_Context $context_
  * @param \Components\Uri $uri_
  */
 public static function dispatch(Http_Scriptlet_Context $context_, Uri $uri_)
 {
     $uri = $context_->getRequest()->getUri();
     $extension = $uri->getFileExtension();
     $name = $uri->getFilename(true);
     $uri_->popPathParam();
     $pathTarget = Environment::pathWeb() . $uri_->getPath() . '/' . \str\decodeUrl($name, true) . ".{$extension}";
     if (false === is_file($pathTarget)) {
         $fileTarget = Io::file($pathTarget);
         $directoryTarget = $fileTarget->getDirectory();
         if (false === $directoryTarget->exists()) {
             $directoryTarget->create();
         }
         $info = @json_decode(\str\decodeBase64Url($name));
         if (false === isset($info[0])) {
             throw new Http_Exception('media/scriptlet/engine', sprintf('Not found [%s].', $uri), Http_Exception::NOT_FOUND);
         }
         $pathSource = Environment::pathWeb($info[0]);
         if (false === is_file($pathSource)) {
             throw new Http_Exception('media/scriptlet/engine', sprintf('Not found [%s].', $uri), Http_Exception::NOT_FOUND);
         }
         if (isset($info[1]) || isset($info[2])) {
             if (!isset($info[1])) {
                 $info[1] = 0;
             }
             if (!isset($info[2])) {
                 $info[2] = 0;
             }
             Io::image($pathSource)->scale(Point::of($info[1], $info[2]))->saveAs($fileTarget);
         } else {
             Io::file($pathSource)->copy($fileTarget);
         }
     }
     header('Content-Length: ' . Io::fileSize($pathTarget)->bytes());
     readfile($pathTarget);
 }
开发者ID:evalcodenet,项目名称:net.evalcode.components.media,代码行数:40,代码来源:engine.php


注:本文中的Point::of方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。