protected function formatSizes($sizes) { $result = array(); foreach ($sizes as $size) { $size_info = shopImage::parseSize((string) $size); $type = $size_info['type']; $width = $size_info['width']; $height = $size_info['height']; if ($type == 'max' || $type == 'crop' || $type == 'width') { $result[] = array($type => $width); } else { if ($type == 'height') { $result[] = array($type => $height); } elseif ($type == 'rectangle') { $result[] = array('rectangle' => array($width, $height)); } } } return $result; }