Skip to content

[Image] Add the Imagor bridge - #4151

Merged
Kocal merged 1 commit into
symfony:3.xfrom
tacman:imagor-image-bridge
Oct 31, 2026
Merged

Kocal merged 1 commit into
symfony:3.xfrom
tacman:imagor-image-bridge

Conversation

@tacman

@tacman tacman commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor
Q A
Bug fix? no
New feature? yes
Deprecations? no
Documentation? yes
Issues
License MIT

This adds symfony/ux-imagor-image, a URL provider for the self-hosted Imagor image server. An application serving /uploads/photo.jpg can keep that source path by configuring the image server and source origin separately:

UX_IMAGE_DSN=imagor://images.example.com?origin=https%3A%2F%2Fwww.example.com&sign_key=your-secret

The implementation is modeled on the existing imgix bridge: provider/factory structure, Composer packaging, PHPUnit tests and renderer snapshots. It uses the same conditional bundle registration and monorepo split conventions, with Imagor-specific URL construction and signing. It supports HTTP for local deployments (secure=false), custom ports, and reverse-proxy prefixes. When no origin is set, it also accepts loader/storage keys and absolute HTTP(S) sources. When origin is set, every source resolves under it. An absolute src cannot point the server at another host. The complete source is encoded before signing so source query strings and filenames cannot become processing instructions.

Width and height map to WIDTHxHEIGHT, cover to Imagor's centered crop, contain to fit-in, and quality/format to filters. A bounded set of image operations preserves filter order; boolean filters can be omitted with false. Common format and quality cannot be replaced through operations. PNG, JPEG, WebP and AVIF are advertised. Automatic format negotiation is not advertised because it requires server configuration; ux_picture() supplies explicit format alternatives.

Signed URLs use Imagor-compatible padded URL-safe Base64 HMAC, with SHA-1 (stock default), SHA-256 or SHA-512 and optional character truncation. The signing configuration must match the server. URLs without a key use unsafe, intended for development.

See the Imagor bridge README for configuration, signing, parameter mapping and supported operations.

Validation

  • 49 bridge tests: source encoding, signing vectors cross-checked with Imagor v1.9.13's Go signer, invalid DSN options and filter injection, compiled-container registration/resolution, and six renderer snapshots.
  • 219 existing UX Image tests.
  • Live stock Imagor 1.9.13: cover, contain, width/height-only resizing, PNG/JPEG/WebP/AVIF, ordered rotate/crop, and rejection of a tampered signed URL.
  • Composer strict validation, Symfony PHP code style on PHP 8.4, DOCtor-RST 1.78.0 with repository rules, and git diff --check.

The split mapping is included. Provisioning the split repository and a Symfony Flex recipe remains a maintainer follow-up.

@carsonbot carsonbot added Documentation Improvements or additions to documentation Feature New Feature Image Status: Needs Review Needs to be reviewed labels Oct 26, 2026
@Kocal
Kocal force-pushed the imagor-image-bridge branch from 5a798ca to 8b0714f Compare October 31, 2026 08:36
@Kocal

Kocal commented Oct 31, 2026

Copy link
Copy Markdown
Member

Thanks for the PR, Tac! I pushed a few changes:

  • I rebased it on 3.x and squashed it into one commit.
  • The bridge now requires symfony/ux-image ^3.7, because ux-image 3.6.0 does not register the imagor bridge.
  • The CHANGELOG entry moved to 3.7.0.
  • To match the IPX bridge, the DSN option scheme=http is now secure=false.
  • The port now comes from Dsn::getPort().
  • Validation now lives only in the factory. The provider no longer re-checks operation names and formats, because ImageUrlGenerator already does it.

I also changed one behavior: when origin is set, an absolute src no longer bypasses it.

Before, the app signed a URL to any host whenever src came from user data, such as an avatar URL. That meant the signature no longer protected the Imagor server.

Without origin, absolute URLs still pass through to the server as before.

@carsonbot carsonbot added Status: Reviewed Has been reviewed by a maintainer and removed Status: Needs Review Needs to be reviewed labels Oct 31, 2026
@Kocal

Kocal commented Oct 31, 2026

Copy link
Copy Markdown
Member

Thank you @tacman.

@Kocal
Kocal merged commit 0f57f9b into symfony:3.x Oct 31, 2026
37 checks passed
@Kocal

Kocal commented Oct 31, 2026

Copy link
Copy Markdown
Member

Recipe : symfony/recipes#1624

Kocal added a commit to Kocal/recipes that referenced this pull request Oct 31, 2026
| Q             | A
| ------------- | ---
| License       | MIT
| Doc issue/PR  |

symfony/ux#4151
@tacman
tacman deleted the imagor-image-bridge branch October 31, 2026 12:06
Kocal added a commit to Kocal/recipes that referenced this pull request Nov 4, 2026
| Q             | A
| ------------- | ---
| License       | MIT
| Doc issue/PR  |

symfony/ux#4151
symfony-recipes-bot pushed a commit to symfony/recipes that referenced this pull request Nov 5, 2026
| Q             | A
| ------------- | ---
| License       | MIT
| Doc issue/PR  |

symfony/ux#4151
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Documentation Improvements or additions to documentation Feature New Feature Image Status: Reviewed Has been reviewed by a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants