FEATURE: automatically downsize large images#10
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| def self.downsize(from, to, max_width, max_height, opts={}) | ||
| optimize("downsize", from, to, max_width, max_height, opts) | ||
| optimize("downsize", from, to, "#{max_width}x#{max_height}", opts) | ||
| end | ||
|
|
||
| def self.optimize(operation, from, to, width, height, opts={}) | ||
| dim = dimensions(width, height) | ||
| def self.downsize(from, to, dimensions, opts={}) | ||
| optimize("downsize", from, to, dimensions, opts) | ||
| end |
There was a problem hiding this comment.
Preserve downsize width/height arity
The new definition of OptimizedImage.downsize at the bottom of this hunk overrides the existing (from, to, max_width, max_height, opts={}) method with one that only accepts a pre-formatted dimensions string. Every existing caller (e.g. Jobs::ResizeEmoji in app/jobs/regular/resize_emoji.rb:14) still passes width, height, and an options hash (5 arguments), so Ruby now raises ArgumentError: wrong number of arguments (5 for 4) as soon as those code paths run, breaking emoji resizing and any other downsize invocation. Please keep the original arity (or add a differently named helper) so callers that supply width/height continue to work while also supporting the new percentage-based use case.
Useful? React with 👍 / 👎.
Test 1
Replicated from ai-code-review-evaluation/discourse-cursor#1