Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add optional width and height params to thumbnail api. increase default to 400x400 #2745

Merged
merged 3 commits into from
Jun 14, 2018

Conversation

fm3
Copy link
Member

@fm3 fm3 commented Jun 14, 2018

Mailable description of changes:

  • Use higher-resolution data for gallery thumbnails

URL of deployed dev instance (used for testing):

Steps to test:

  • thumbnails in gallery should look sharper than before (400×400 rather than 200×200)
  • thumbnails should still not feature black borders (or acceptably little) – if that does not work, we might have to change the parameter selection
  • try optional url parameters in /api/datasets/:dataSetName/layers/:layer/thumbnail?w=<Int>&h=<Int>

Issues:


  • Ready for review

Copy link
Member

@philippotto philippotto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, works flawlessly for me 👍

def imageFromCacheIfPossible(dataSet: DataSet) = {
val width = Math.limit(w.getOrElse(DefaultThumbnailWidth), 1, MaxThumbnailHeight)
val height = Math.limit(h.getOrElse(DefaultThumbnailHeight), 1, MaxThumbnailHeight)
// We don't want all images to expire at the same time. Therefore, we add a day of randomness, hence the 1 day
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know it's been like that before, but wouldn't the comment make more sense before line 58?


def limit[T](x: T, lower: T, upper: T)(implicit num: Numeric[T]): T = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't heard of limit for this usecase before and would have rather used clamp. But maybe I'm missing some street knowledge here :)

Copy link
Contributor

@youri-k youri-k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@fm3 fm3 merged commit 640b21a into master Jun 14, 2018
@fm3 fm3 deleted the thumbnailsize branch June 14, 2018 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants