Пример #1
0
 /**
  * Returns URL of a product image. 
  * 
  * @param array $image Key-value image data object
  * @param string $size Size value string (e.g., '200x0', '96x96', etc.)
  * @param bool $absolute Whether absolute URL must be returned
  * @return string
  */
 public static function getUrl($image, $size = null, $absolute = false)
 {
     $path = shopProduct::getFolder($image['product_id']) . "/{$image['product_id']}/images/{$image['id']}/{$image['id']}.{$size}.{$image['ext']}";
     if (waSystemConfig::systemOption('mod_rewrite')) {
         return wa()->getDataUrl($path, true, 'shop', $absolute);
     } else {
         if (file_exists(wa()->getDataPath($path, true, 'shop'))) {
             return wa()->getDataUrl($path, true, 'shop', $absolute);
         } else {
             $path = str_replace('products/', 'products/thumb.php/', $path);
             return wa()->getDataUrl($path, true, 'shop', $absolute);
         }
     }
 }