Make image resizing Vips compatible #95
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Until now, we used the ImageMagick exclusive
"200x300>"
syntax, so any project that uses shimmer is forced to also use ImageMagick. Since Vips is much much faster, we want to switch. But first, we have to adjust Shimmer to be compatible.This was not too hard since we mostly don't leak the ImageMagick-style strings to the outside. We persist them in the generated
id
(which is used in the URLs). Themessage_verifier.generate
method can encode arbitrary data, so we don't use these strings anymore from now on. Instead, we directly save[width, height]
tuples.BUT we don't want all our URLs to change at once: This would break any hotlinked URLs (maybe not a big deal), but also invalidate all our caches. So we grandfather in old URLs for now. Maybe we can remove them in 10 years.
Since we're switching to the ImageProcessing-style
resize_to_limit: [width, height]
format, this new version should in theory be compatible with BOTH ImageMagick AND Vips.Some apps, like Copa, use
FileProxy
directly and pass a ImageMagick-style string. These need to be fixed before we can upgrade Shimmer there. https://github.com/search?q=org%3Anerdgeschoss+FileProxy&type=code(This PR also includes a little overhaul to CI and the Rails test app.)
Bonus: Fixes #59. Rubocop works for all three Ruby versions in the matrix now.