Example #1
0
 /**
  * renderAllImages
  * @author Cornelius Hansjakob <*****@*****.**>
  * @version 1.0
  */
 public function renderAllImages()
 {
     $this->core->logger->debug('massiveart.images.Image->renderAllImages()');
     try {
         $this->getModelFile();
         /**
          * check public file path
          */
         $this->checkPublicFilePath();
         $objImageFiles = $this->objModelFile->getAllImageFiles();
         if (count($objImageFiles) > 0) {
             foreach ($objImageFiles as $objImageFile) {
                 $srcFile = $this->getUploadPath() . $objImageFile->filename;
                 if (count($this->arrDefaultImageSizes) > 0) {
                     $objImageManipulation = new ImageManipulation();
                     $objImageManipulation->setAdapterType($this->core->sysConfig->upload->images->adapter);
                     /**
                      * get image manipulation adapter
                      */
                     $objImageAdapter = $objImageManipulation->getAdapter();
                     $objImageAdapter->setRawWidth($objImageFile->xDim);
                     $objImageAdapter->setRawHeight($objImageFile->yDim);
                     /**
                      * render default image sizes
                      */
                     foreach ($this->arrDefaultImageSizes as $arrImageSize) {
                         $objImageAdapter->setSource($srcFile);
                         $objImageAdapter->setDestination($this->getPublicFilePath() . $arrImageSize['folder'] . '/' . $objImageFile->filename);
                         $this->checkPublicFilePath($arrImageSize['folder'] . '/');
                         if (array_key_exists('actions', $arrImageSize) && is_array($arrImageSize['actions'])) {
                             if (array_key_exists('method', $arrImageSize['actions']['action'])) {
                                 $arrAction = $arrImageSize['actions']['action'];
                                 $strMethode = $arrAction['method'];
                                 $arrParams = array_key_exists('params', $arrAction) ? explode(',', $arrAction['params']) : array();
                                 if (method_exists($objImageAdapter, $strMethode)) {
                                     call_user_func_array(array($objImageAdapter, $strMethode), $arrParams);
                                 }
                             } else {
                                 foreach ($arrImageSize['actions']['action'] as $arrAction) {
                                     if (array_key_exists('method', $arrAction)) {
                                         $strMethode = $arrAction['method'];
                                         $arrParams = array_key_exists('params', $arrAction) ? explode(',', $arrAction['params']) : array();
                                         if (method_exists($objImageAdapter, $strMethode)) {
                                             call_user_func_array(array($objImageAdapter, $strMethode), $arrParams);
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     } catch (Exception $exc) {
         $this->core->logger->err($exc);
     }
 }