Skip to content

Render Cloud PDF transforms as images#180

Merged
timkelty merged 13 commits into
3.xfrom
timkelty/cloud-pdf-get-img
Jul 9, 2026
Merged

Render Cloud PDF transforms as images#180
timkelty merged 13 commits into
3.xfrom
timkelty/cloud-pdf-get-img

Conversation

@timkelty

@timkelty timkelty commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Adds a Cloud Twig helper for rendering signed PDF transform URLs as <img> markup without changing Craft’s normal image gates.

Copilot AI review requested due to automatic review settings July 9, 2026 12:11

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.

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 native Asset::getImg() for non-PDF assets, and render <img> for PDFs only when a signed transform URL is available.
  • Support passing a PDF page transform 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 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".

Comment thread src/imagetransforms/ImageTransformBehavior.php
Copilot AI review requested due to automatic review settings July 9, 2026 12:43

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.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

Comment thread src/twig/CloudVariable.php
Comment thread src/twig/CloudVariable.php Outdated
Comment thread src/imagetransforms/ImageTransformer.php Outdated
Copilot AI review requested due to automatic review settings July 9, 2026 13:09

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.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Comment thread src/imagetransforms/ImageTransformer.php Outdated
Copilot AI review requested due to automatic review settings July 9, 2026 14:50

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.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Comment thread src/imagetransforms/ImageTransformer.php Outdated
Copilot AI review requested due to automatic review settings July 9, 2026 14:57

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.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Comment thread src/imagetransforms/ImageTransformer.php Outdated
Copilot AI review requested due to automatic review settings July 9, 2026 15:10

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.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings July 9, 2026 15:38

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.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Comment thread src/imagetransforms/ImageTransformer.php Outdated
Copilot AI review requested due to automatic review settings July 9, 2026 15:49

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.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Comment thread src/imagetransforms/ImageTransformer.php Outdated
Copilot AI review requested due to automatic review settings July 9, 2026 15:56

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.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings July 9, 2026 16:05

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.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Comment thread src/twig/CloudVariable.php
Copilot AI review requested due to automatic review settings July 9, 2026 16:09

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.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Comment thread src/imagetransforms/ImageTransformer.php
Copilot AI review requested due to automatic review settings July 9, 2026 16:33

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.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Comment thread src/twig/CloudVariable.php
Copilot AI review requested due to automatic review settings July 9, 2026 17:02

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.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

@timkelty
timkelty merged commit 7cb94ab into 3.x Jul 9, 2026
10 checks passed
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.

2 participants