本文整理汇总了PHP中Environment::pathResource方法的典型用法代码示例。如果您正苦于以下问题:PHP Environment::pathResource方法的具体用法?PHP Environment::pathResource怎么用?PHP Environment::pathResource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Environment
的用法示例。
在下文中一共展示了Environment::pathResource方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
示例2: load
private function load()
{
$path = Environment::pathResource($this->path);
if (false === @is_file($manifest = $path . '/' . self::NAME_MANIFEST)) {
throw new Runtime_Exception_Internal('media/store', sprintf('Unable to resolve media store manifest [path: %1$s, manifest: %2$s].', $path, self::NAME_MANIFEST));
}
$this->m_manifest = @json_decode(file_get_contents($manifest), true);
$this->uri = $this->m_manifest['uri'];
$this->m_storage = new $this->m_manifest['storage']();
$this->m_storage->init($this);
foreach ($this->m_manifest['schema'] as $schema) {
foreach ($schema as $name => $scheme) {
$this->m_schema[$name] = $scheme;
}
}
}
示例3: copyCategory
/**
* @see \Components\Media_Storage::copyCategory() \Components\Media_Storage::copyCategory()
*/
public function copyCategory($categorySource_, $categoryTarget_)
{
$source = Io::path(Environment::pathResource("{$this->store->path}/{$categorySource_}"));
if (false === $source->exists()) {
return false;
}
$source->copy(Io::path(Environment::pathResource("{$this->store->path}/{$categoryTarget_}")));
return true;
}