Skip to content

Require image_processing 2.2.0 and drop the transform rename - #82

Merged
flavorjones merged 2 commits into
masterfrom
card-574-image-processing-2-2
Sep 30, 2026
Merged

flavorjones merged 2 commits into
masterfrom
card-574-image-processing-2-2

Conversation

@flavorjones

Copy link
Copy Markdown
Member

Motivation

A transform operation writes its output to a scratch path that has no extension. image_processing 2.1.0 chose its saver from the destination's extension. So Transforming#perform encoded to a sibling path named with the format as its extension, and renamed that file into place (transforming.rb#L17-L25).

image_processing 2.2.0 saves in the #convert format when the destination has no extension (janko/image_processing#150), so the rename is no longer needed.

Fixes #4

Details

  • activestorage-hotcell-server requires image_processing 2.2.0, and Gemfile.lock pins that version.
  • Transforming#perform writes straight to the output's scratch path.
  • transformers.image.magick now fails as unreadable for a format ImageMagick has no name for, such as jfif. Before, ImageMagick ignored an extension it did not recognise and wrote the source's format. Stock Rails is unaffected, because it calls image_processing without a destination. This PR does not address that failure.

image_processing 2.1.0 chose its saver from the destination's
extension, so the transform operations encoded to a suffixed sibling of
the extensionless scratch path and renamed it into place.

Require image_processing 2.2.0, which saves in the `#convert` format
to a destination without an extension, and write to the scratch path
directly.

On the ImageMagick toolchain, a format ImageMagick has no name for,
such as `jfif`, now fails as `unreadable` instead of being written in
the source's format.

ref: janko/image_processing#150
[Fix #4]
Copilot AI balanced review requested due to automatic review settings September 30, 2026 19:21

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

The CHANGELOG entry described a known edge case that a separate fix
will handle, and did not mention the rename every transform now saves.
@flavorjones
flavorjones merged commit 1ff4726 into master Sep 30, 2026
16 checks passed
@flavorjones
flavorjones deleted the card-574-image-processing-2-2 branch September 30, 2026 19:47
flavorjones added a commit that referenced this pull request Oct 7, 2026
* Fix JPEG variants uploaded as .jfif, .jif or .jfi

Since #82, the ImageMagick transformer failed a JPEG uploaded as .jfif,
.jif or .jfi permanently as `unreadable`. The Vips transformer has
always failed .jif and .jfi the same way. Send the cell the canonical
extension of a web image format's content type, which is the extension
Rails falls back to when an upload's extension does not match.

[Fix #84]

* Test that a non-web-image format crosses unchanged

The pass-through for a format outside `web_image_content_types` had no
test, so removing the guard would have left the suite green.

* Note the canonical format in the Vips transformer comment

The comment said the format reached ImageProcessing exactly as Rails
handed it over, which stopped being true when the client began sending
a web image's canonical extension.
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.

Upstream image_processing: route the saver by an explicit format argument, not the destination extension

2 participants