app/publisher: variable width images in UI

Change the css to allow variable width images, keep constant height only.

Use a fixed limit maxThumbWidthRatio to limit thumbnail image width
for panoramic images.

Fixes #902

Change-Id: I60c16c63b018680885c67f00b47e2e96c8dba47e
This commit is contained in:
Attila Tajti 2017-04-24 11:33:08 +02:00
parent 8a545a1ed2
commit c5b444807b
3 changed files with 8 additions and 7 deletions

View File

@ -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) {

View File

@ -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
@ -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

View File

@ -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 {