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();
 }
 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;
         }
     }
 }
 /**
  * @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;
 }