Force favicons to appear at 16x16 in the detail view. Allow favicons to appear larger, when they are in fact larger.

This commit is contained in:
Brent Simmons 2018-02-25 22:46:25 -08:00
parent b6d29d9b14
commit a3778e04a2
1 changed files with 4 additions and 2 deletions

View File

@ -222,7 +222,7 @@ class ArticleRenderer {
func html(dimension: Int) -> String {
let imageTag = "<img src=\"\(imageURL)\" width=\"\(dimension)\" height=\"\(dimension)\""
let imageTag = "<img src=\"\(imageURL)\" width=\(dimension) height=\(dimension) />"
if let url = url {
return linkWithText(imageTag, url)
}
@ -238,7 +238,9 @@ class ArticleRenderer {
if let favicon = appDelegate.faviconDownloader.favicon(for: feed) {
if let s = base64String(forImage: favicon) {
let imgTag = "<img src=\"data:image/tiff;base64, " + s + "\" height=16 width=16 />"
var dimension = min(favicon.size.height, 48) // Assuming square images.
dimension = max(dimension, 16) // Some favicons say theyre < 16. Force them larger.
let imgTag = "<img src=\"data:image/tiff;base64, " + s + "\" height=\(dimension) width=\(dimension) />"
ArticleRenderer.faviconImgTagCache[feed] = imgTag
return imgTag
}