Render Cloud PDF transforms as images#180
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a Craft Cloud Twig helper that can render signed PDF transform URLs as <img> markup, enabling PDF “rasterized” transforms to be displayed like images while preserving Craft’s usual image/PDF gating behavior.
Changes:
- Add
CloudVariable::getImg()to delegate to nativeAsset::getImg()for non-PDF assets, and render<img>for PDFs only when a signed transform URL is available. - Support passing a PDF
pagetransform option through to Cloudflare transform query options. - Add/adjust unit tests covering PDF page transforms and the new Twig helper behavior (delegation, signed/unsigned PDF handling).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/twig/CloudVariable.php |
Introduces getImg() helper to render signed PDF transforms as <img> while delegating non-PDF rendering to Craft. |
src/imagetransforms/ImageTransformBehavior.php |
Adds page as a transform behavior option so it can be serialized into Cloudflare transform query params. |
tests/unit/ImageTransformTest.php |
Expands unit tests for PDF page transforms and validates the new Cloud Twig helper behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2fe5faab72
ℹ️ 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".
Adds a Cloud Twig helper for rendering signed PDF transform URLs as
<img>markup without changing Craft’s normal image gates.