Quick Search:

Mode

Context

Displaying 3 lines of context. None | Less | More | Full

Other Diffs

Ignore

Blank Lines Whitespace:

Diff

559
 
583
 
583
 
image.php
_> 1111 */
  1212 
  1313   class osC_Image {
<> 14 -    var $_data;
   14+    var $_groups;
1515 
  1616     function osC_Image() {
<> 17 -      global $osC_Database;
   17+      global $osC_Database, $osC_Language;
1818 
<> 19 -      $Qgroups = $osC_Database->query('select distinct id, code, size_height as height, size_width as width from :table_products_images_groups');
   19+      $this->_groups = array();
   20+
   21+      $Qgroups = $osC_Database->query('select * from :table_products_images_groups where language_id = :language_id');
2022       $Qgroups->bindTable(':table_products_images_groups', TABLE_PRODUCTS_IMAGES_GROUPS);
<> 21 -      $Qgroups->setCache('images_groups');
   23+      $Qgroups->bindInt(':language_id', $osC_Language->getID());
   24+      $Qgroups->setCache('images_groups-' . $osC_Language->getID());
2225       $Qgroups->execute();
  2326 
  2427       while ($Qgroups->next()) {
<> 25 -        $this->_data[$Qgroups->value('code')] = $Qgroups->toArray();
   28+        $this->_groups[$Qgroups->valueInt('id')] = $Qgroups->toArray();
2629       }
  2730 
  2831       $Qgroups->freeResult();
  2932     }
  3033 
  3134     function getID($code) {
<> 32 -      return $this->_data[$code]['id'];
   35+      foreach ($this->_groups as $group) {
   36+        if ($group['code'] == $code) {
   37+          return $group['id'];
   38+        }
   39+      }
   40+
   41+      return 1;
3342     }
  3443 
<>  44+    function getCode($id) {
   45+      return $this->_groups[$id]['code'];
   46+    }
   47+
3548     function getWidth($code) {
<> 36 -      return $this->_data[$code]['width'];
   49+      return $this->_groups[$this->getID($code)]['size_width'];
3750     }
  3851 
  3952     function getHeight($code) {
<> 40 -      return $this->_data[$code]['height'];
   53+      return $this->_groups[$this->getID($code)]['size_height'];
4154     }
  4255 
  4356     function show(&$image, &$title, $parameters = '', $group = 'default') {
<> 44 -      if (isset($this->_data[$group]) === false) {
  45 -        $group = 'default';
   57+      $group_id = $this->getID($group);
   58+
   59+      $width = $height = '';
   60+
   61+      if ($this->_groups[$group_id]['force_size'] == '1') {
   62+        $width = $this->_groups[$group_id]['size_width'];
   63+        $height = $this->_groups[$group_id]['size_height'];
4664       }
  4765 
<> 48 -      return tep_image(DIR_WS_IMAGES . $image, $title, $this->_data[$group]['width'], $this->_data[$group]['height'], $parameters);
   66+      return tep_image(DIR_WS_HTTP_CATALOG . DIR_WS_IMAGES . 'products/' . $this->_groups[$group_id]['code'] . '/' . $image, $title, $width, $height, $parameters);
4967     }
<>  68+
   69+    function getAddress(&$image, $group = 'default') {
   70+      $group_id = $this->getID($group);
   71+
   72+      return DIR_WS_IMAGES . 'products/' . $this->_groups[$group_id]['code'] . '/' . $image;
   73+    }
5074   }
<_ 51 -?>
   75+?>