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

feat: random of aspect ratio #1

Merged
merged 4 commits into from
Oct 2, 2023
Merged

feat: random of aspect ratio #1

merged 4 commits into from
Oct 2, 2023

Conversation

katlyn
Copy link
Contributor

@katlyn katlyn commented Oct 1, 2023

This pull request adds functionality that allows users to request a random image of a specific aspect ratio. Currently, the logic works as follows:

  • Place all shiggies in a cache map based on their computed aspect ratio
  • When a request comes in that specifies an aspect ratio, get a random shiggy of that aspect ratio
  • If there are no shiggies of that exact aspect ratio, return a shiggy of the next closest aspect ratio.

I messed with a few ideas like grouping images with similar aspect ratios to improve selection, but this ended up not working super well as it merged some common aspect ratios. Someone more familiar with fuzzy grouping might have a better solution than I did to resolve that issue. In the meantime, an aspect-ratio-variance parameter is available that allows users to specify how much variance to use when filtering images to be randomly returned.

I did not implement tests as v3 does not have them, but can if requested.

This parameter allows users to specify how much variance in the aspect
ratio to allow when searching for an image. In the event an image still
isn't found that matches the aspect ratio, the next closest is still
returned.
@lillithkt
Copy link
Member

Looks Great!

@lillithkt lillithkt merged commit 42b3e4d into shigandco:main Oct 2, 2023
1 check passed
@katlyn katlyn deleted the feat/random-of-aspect-ratio branch October 2, 2023 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants