()
| 5220 | } |
| 5221 | |
| 5222 | func (w *InternetContents) Width() int { |
| 5223 | |
| 5224 | asrString := w.Card.Properties.Get("aspect ratio").AsString() |
| 5225 | split := strings.FieldsFunc(asrString, func(r rune) bool { return r == ':' || r == ' ' }) |
| 5226 | |
| 5227 | width, _ := strconv.Atoi(split[0]) |
| 5228 | height, _ := strconv.Atoi(split[1]) |
| 5229 | |
| 5230 | asr := float64(height) / float64(width) |
| 5231 | |
| 5232 | sizeString := w.Card.Properties.Get("size").AsString() |
| 5233 | s, _ := strconv.Atoi(sizeString[:len(sizeString)-1]) |
| 5234 | size := float64(s) |
| 5235 | |
| 5236 | fWidth := size * (1 / asr) |
| 5237 | if asr > 1 { |
| 5238 | fWidth = size |
| 5239 | } |
| 5240 | return int(math.Round(fWidth)) |
| 5241 | } |
| 5242 | |
| 5243 | func (w *InternetContents) Height() int { |
| 5244 |
no test coverage detected