-
Notifications
You must be signed in to change notification settings - Fork 538
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
Best way to shorten urls #335
Comments
@Livijn, you can use Thumbor URL to resize, set format, set quality, and etc. please refer to https://docs.aws.amazon.com/solutions/latest/serverless-image-handler/thumbor-filters.html. {
"bucket": "getdogsapp",
"key": "content\/d9322f40-03ba-44fc-b8fd-d336bc258ab0",
"edits": {
"webp": {
"quality": 80
},
"jpeg": {
"quality": 80
},
"resize": {
"width": 64,
"height": 64,
"fit": "cover"
},
"contentModeration": {
"minConfidence": 90,
"blur": 100,
"moderationLabels": [
"Explicit Nudity",
"Violence",
"Visually Disturbing",
"Hate Symbols"
]
}
}
} which is not supported by Thumbor URL. Since you use the same settings, you can update the handler. |
Yes, I know I can use Thumbor URLs but; a) they don't support all edits; b) they are still very long & ugly urls. I'll try updating the handler, but that feels less "robust" when perhaps updating etc in the future. |
To add to this, I'm very interested easier semantic URLs – there was a discussion on this earlier which settled on a design that would be perfect using query parameters However it seems like this didn't reach master (doesn't seem to work on the stack I just created) Query parameters are much easier to work with than Thumbor style urls – for example, we can store the base image URL and append options as we need in the frontend: <img src={url + '?width=200&height=200&fit-in=cover} /> However, with filters in the middle of the url as it currently is, we'd need to patch the url which introduces complications The added benefit of this is that if the url doesn't support the query parameters, at least something loads, however with Thumbor-style it will be a broken image link |
I updated the handler and deployed a custom solution. |
Thanks @Livijn! |
I am using the base64-option to generate my urls. However, the urls are getting very large. For example:
What would be the best way to make these shorter?
I could use CloudFlare workers to generate urls like this: https://images.domain.com/some-id/size which then redirects the response to the base64-encoded url. However, I don't want to combine CloudFlare for this since that feels redundant.
I guess I could do something similar with CloudFront? Or should I just modify the backend-handler? I always pass the same settings, except for width & height.
The text was updated successfully, but these errors were encountered: