Exemple #1
0
 static function composeImages($controller, $obj, $dir, $fieldName = 'Images')
 {
     $getMethod = 'get' . $fieldName;
     $imgs = array();
     if (is_callable(array($obj, $getMethod))) {
         $imgs = $obj->{$getMethod}();
     }
     $images = array();
     if ($imgs) {
         foreach ($imgs as $img) {
             $relPath = "/content/{$dir}/" . rawurlencode($img);
             if (strpos($img, '/') === 0) {
                 $relPath = $img;
             }
             $image = $img;
             if (!Helper_URL::isURL($img)) {
                 $image = $controller->composeResource($relPath);
             }
             $images[] = $image;
         }
     }
     return $images;
 }