Example #1
0
 public static function getMediaOutput($id, $type, $className)
 {
     $component = Kwf_Component_Data_Root::getInstance()->getComponentById($id, array('ignoreVisible' => true));
     if (!$component) {
         return null;
     }
     $data = $component->getComponent()->getImageDataOrEmptyImageData();
     if (!$data) {
         return null;
     }
     $dimension = $component->getComponent()->getImageDimensions();
     return Kwf_Media_Output_Component::getMediaOutputForDimension($data, $dimension, $type);
 }
 public static function getMediaOutput($id, $type, $className)
 {
     $component = Kwf_Component_Data_Root::getInstance()->getComponentById($id, array('ignoreVisible' => true));
     if (!$component) {
         return null;
     }
     $data = $component->getComponent()->getImageData();
     if (!$data) {
         return null;
     }
     if ($type == 'original') {
         return array('file' => $data['file'], 'downloadFilename' => $data['filename'], 'mimeType' => $data['mimeType']);
     } else {
         $dimension = $component->getComponent()->getImageDimensions();
         return Kwf_Media_Output_Component::getMediaOutputForDimension($data, $dimension, $type);
     }
 }