Skip to content

Commit

Permalink
Merge "app/publisher: variable width images in UI"
Browse files Browse the repository at this point in the history
  • Loading branch information
mpl authored and Gerrit Code Review committed Apr 29, 2017
2 parents 8fa2ec5 + c5b4448 commit 8f1a7df
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions app/publisher/js/file.go
Expand Up @@ -539,10 +539,10 @@ func (fit *fileItem) setThumb(fic *fileItemContainer) {
return
}
if fic.isTopNode {
fit.thumb = fmt.Sprintf("%s/h%s/=i/%s/?mw=%d&mh=%d", fic.basePath, fit.contentRef.DigestPrefix(10), url.QueryEscape(fit.fileName), fic.thumbHeight, fic.thumbHeight)
fit.thumb = fmt.Sprintf("%s/h%s/=i/%s/?mw=%d&mh=%d", fic.basePath, fit.contentRef.DigestPrefix(10), url.QueryEscape(fit.fileName), maxThumbWidthRatio*fic.thumbHeight, fic.thumbHeight)
return
}
fit.thumb = fmt.Sprintf("%s/h%s/h%s/=i/%s/?mw=%d&mh=%d", fic.basePath, fit.pn.DigestPrefix(10), fit.contentRef.DigestPrefix(10), url.QueryEscape(fit.fileName), fic.thumbHeight, fic.thumbHeight)
fit.thumb = fmt.Sprintf("%s/h%s/h%s/=i/%s/?mw=%d&mh=%d", fic.basePath, fit.pn.DigestPrefix(10), fit.contentRef.DigestPrefix(10), url.QueryEscape(fit.fileName), maxThumbWidthRatio*fic.thumbHeight, fic.thumbHeight)
}

func (fit *fileItem) setDownload(fic *fileItemContainer) {
Expand Down
9 changes: 5 additions & 4 deletions app/publisher/js/members.go
Expand Up @@ -35,9 +35,10 @@ import (
const (
bicMembersList = "ul#members" // jquery matching convenience
// TODO(mpl): derive precisely how much blobItemHeight should be from thumbHeight + various margins in css
thumbnailHeight = 200
blobItemHeight = 250 // thumbHeight + some slack
getMembersLimit = 50 // how many more items to fetch in search queries
thumbnailHeight = 200
maxThumbWidthRatio = 3 // maximum thumb width is height*maxThumbWidthRatio
blobItemHeight = 250 // thumbHeight + some slack
getMembersLimit = 50 // how many more items to fetch in search queries
)

var theBic *blobItemContainer
Expand Down Expand Up @@ -391,7 +392,7 @@ func (bi *blobItem) thumbnail(pathPrefix, basePath string, thumbHeight int) stri
switch {
case bi.isImage:
// TODO(mpl): should we/can we prefetch the image?
bi.thumb = fmt.Sprintf("%s/h%s/h%s/=i/%s/?mw=%d&mh=%d", basePath, bi.pn.DigestPrefix(10), bi.contentRef.DigestPrefix(10), url.QueryEscape(bi.fileName), thumbHeight, thumbHeight)
bi.thumb = fmt.Sprintf("%s/h%s/h%s/=i/%s/?mw=%d&mh=%d", basePath, bi.pn.DigestPrefix(10), bi.contentRef.DigestPrefix(10), url.QueryEscape(bi.fileName), maxThumbWidthRatio*thumbHeight, thumbHeight)
case bi.isDir:
bi.thumb = fmt.Sprintf("%s=s/folder.png", pathPrefix)
case bi.fileName != "": // isFile, but not image
Expand Down
2 changes: 1 addition & 1 deletion app/publisher/pics.css
Expand Up @@ -65,7 +65,7 @@ li img {
border-radius: 6px;
display: block;
max-height: 200px;
max-width: 200px;
max-width: 600px;
margin-bottom: 1em;
}
li .camlifile {
Expand Down

0 comments on commit 8f1a7df

Please sign in to comment.