Skip to content

Conversation

@mohdlatif
Copy link
Contributor

No description provided.

return { data, name: font, style, weight };
}

// ... other font loading strategies available in the full source code
Copy link
Contributor

Choose a reason for hiding this comment

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

Any code required to create a fully functional app should be visible in the tutorial. If there are code blocks that are optional to finish the app you can include them in the tutorial under a dropdown, but otherwise should be displayed in a code block up front.

@kodster28 kodster28 added developer-spotlight DevRel Tasks that need support from developer relations. labels Feb 11, 2025
@harshil1712
Copy link
Contributor

Hey @mohdlatif, is the tutorial ready for review? I see there is a comment still pending. Can you please address that, so that we can move to the review and it updated? Thank you!

@mohdlatif
Copy link
Contributor Author

Hey @mohdlatif, is the tutorial ready for review? I see there is a comment still pending. Can you please address that, so that we can move to the review and it updated? Thank you!

This should be done today. Thank you for reminding me.

Including missing source code
`Any code required to create a fully functional app should be visible in the tutorial`
@github-actions github-actions bot added size/xl and removed size/l labels Feb 22, 2025
@mohdlatif
Copy link
Contributor Author

Hi @harshil1712 @db-cloudflare @kodster28,
I have updated the tutorial with the missing source code. All good now?

Copy link
Contributor

@lauragift21 lauragift21 left a comment

Choose a reason for hiding this comment

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

@mohdlatif, I’ve gone through the tutorial and left some feedback. Let me know if you need any clarifications

<PackageManagers
type="create"
pkg="cloudflare@latest"
args="og-image-generator --template cloudflare-workers --pm npm"
Copy link
Contributor

Choose a reason for hiding this comment

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

I noticed that the command currently used here results in an error. If you intend to create a Hono app, you can use the --framework flag. The correct command should be:

npm create cloudflare@latest -- og-image-generator --framework=hono --experimental

<PackageManagers
type="create"
pkg="cloudflare@latest"
args="og-image-generator --template cloudflare-workers --pm npm"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
args="og-image-generator --template cloudflare-workers --pm npm"
args="og-image-generator --framework=hono --experimental"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you


Generate OG images by making `GET` requests:

```txt
Copy link
Contributor

Choose a reason for hiding this comment

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

The example request does not include footerText, but it's required in the API. Either make footerText optional in the implementation or update the example to include it.

![Style 3 Preview](~/assets/images/workers/tutorials/dynamic-og-images/style-3.png)

```txt
/og?style=3&mainText=Company%20Update&description=Q4%20Results
Copy link
Contributor

Choose a reason for hiding this comment

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

The example request does not include footerText, but it's required in the API. Either make footerText optional in the implementation or update the example to include it.

Copy link
Contributor

@Oxyjun Oxyjun left a comment

Choose a reason for hiding this comment

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

PCX review


import { PackageManagers, Render, Tabs, TabItem, WranglerConfig } from "~/components";

Social media thrives on compelling visuals. With Cloudflare Workers, you can effortlessly generate dynamic Open Graph (OG) images that grab attention and boost platform performance. In this tutorial, you'll learn how to create a customizable OG image generator powered by serverless edge computing. Cloudflare Workers enable you to deliver blazing-fast visuals globally, ensuring a seamless experience for your users. Let's dive in to see how you can take your OG images to the next level with Cloudflare Workers.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Social media thrives on compelling visuals. With Cloudflare Workers, you can effortlessly generate dynamic Open Graph (OG) images that grab attention and boost platform performance. In this tutorial, you'll learn how to create a customizable OG image generator powered by serverless edge computing. Cloudflare Workers enable you to deliver blazing-fast visuals globally, ensuring a seamless experience for your users. Let's dive in to see how you can take your OG images to the next level with Cloudflare Workers.
Social media thrives on compelling visuals. With Cloudflare Workers, you can effortlessly generate dynamic Open Graph (OG) images that grab attention and boost platform performance. In this tutorial, you will learn how to create a customizable OG image generator powered by serverless edge computing. Cloudflare Workers enable you to deliver blazing-fast visuals globally, ensuring a seamless experience for your users. Dive in to see how you can take your OG images to the next level with Cloudflare Workers.

Avoiding contractions

Comment on lines +39 to +41
- Global Reach: Deliver your images with ultra-low latency, no matter where your users are located.
- Serverless Simplicity: Focus on building features, not managing infrastructure.
- Unparalleled Performance: Process and serve requests at the edge for blazing-fast load times.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- Global Reach: Deliver your images with ultra-low latency, no matter where your users are located.
- Serverless Simplicity: Focus on building features, not managing infrastructure.
- Unparalleled Performance: Process and serve requests at the edge for blazing-fast load times.
- **Global reach**: Deliver your images with ultra-low latency, no matter where your users are located.
- **Serverless simplicity**: Focus on building features, not managing infrastructure.
- **Unparalleled performance**: Process and serve requests at the edge for blazing-fast load times.

- Serverless Simplicity: Focus on building features, not managing infrastructure.
- Unparalleled Performance: Process and serve requests at the edge for blazing-fast load times.

By leveraging Cloudflare Workers, you get a serverless edge-computing environment that is not only cost-efficient but also perfectly optimized for modern web applications.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
By leveraging Cloudflare Workers, you get a serverless edge-computing environment that is not only cost-efficient but also perfectly optimized for modern web applications.
By leveraging Cloudflare Workers, you get a serverless edge-computing environment that is not only cost-efficient, but also perfectly optimized for modern web applications.

Comment on lines +49 to +53
1. Request Received: A URL with parameters is sent to a Cloudflare Worker.
2. Content Processed: The Worker extracts text, style, and font configurations from the URL.
3. Font Loaded: Fonts are retrieved using one of four methods, like Google Fonts or local files.
4. Image Generated: The image is built using React components styled with Tailwind CSS.
5. Response Cached: The final image is returned and cached for future requests.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
1. Request Received: A URL with parameters is sent to a Cloudflare Worker.
2. Content Processed: The Worker extracts text, style, and font configurations from the URL.
3. Font Loaded: Fonts are retrieved using one of four methods, like Google Fonts or local files.
4. Image Generated: The image is built using React components styled with Tailwind CSS.
5. Response Cached: The final image is returned and cached for future requests.
1. Receives request: A Cloudflare Worker receives a URL with parameters.
2. Processes content: The Worker extracts text, style, and font configurations from the URL.
3. Loads font: The Worker retrieves fonts using one of four methods, like Google Fonts or local files.
4. Generates image: The Worker builds the image using React components styled with Tailwind CSS.
5. Caches response: The Worker returns the final image and caches it for future requests.

Using active voice.

Comment on lines +68 to +74
- **Edge computing**: Generates images at the edge using Cloudflare Workers
- **Modern rendering**: Utilizes Vercel's Satori library for high-quality image generation
- **Flexible styling**: Supports both Tailwind CSS and inline styles
- **Font versatility**: Multiple font loading strategies for different use cases
- **Performance optimized**: Built-in caching and optimization
- **Customizable**: Easy to extend with new styles and font configurations
- **Developer friendly**: TypeScript support and modular architecture
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- **Edge computing**: Generates images at the edge using Cloudflare Workers
- **Modern rendering**: Utilizes Vercel's Satori library for high-quality image generation
- **Flexible styling**: Supports both Tailwind CSS and inline styles
- **Font versatility**: Multiple font loading strategies for different use cases
- **Performance optimized**: Built-in caching and optimization
- **Customizable**: Easy to extend with new styles and font configurations
- **Developer friendly**: TypeScript support and modular architecture
- **Edge computing**: Generates images at the edge using Cloudflare Workers
- **Modern rendering**: Utilizes Vercel's Satori library for high-quality image generation
- **Flexible styling**: Supports both Tailwind CSS and inline styles
- **Font versatility**: Allows multiple font loading strategies for different use cases
- **Performance**: Uses built-in caching and optimization
- **Customizable**: Scales easily with new styles and font configurations
- **Developer friendly**: Offers TypeScript support and modular architecture

Using active voice.

- Decrease origin server load
- Provide consistent performance

Here's how to implement caching with customizable durations:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Here's how to implement caching with customizable durations:
To implement caching with customizable durations:


## Set up TypeScript type definitions

Let's create our type definitions to ensure smooth TypeScript integration. Create a new file `src/type.d.ts`:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Let's create our type definitions to ensure smooth TypeScript integration. Create a new file `src/type.d.ts`:
Create type definitions to ensure smooth TypeScript integration. Create a new file `src/type.d.ts`:

Make sure to configure appropriate cache durations based on your application's needs. The example uses a 24-hour cache duration.
:::

## Set up TypeScript type definitions
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
## Set up TypeScript type definitions
## 9. Set up TypeScript type definitions

Should this be step 9?


With these definitions in place, you will get full TypeScript support and autocompletion throughout your project. This makes development smoother and helps catch potential issues early.

## 9. Deploy your Worker
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
## 9. Deploy your Worker
## 10. Deploy your Worker

- GitHub avatar integration
- Perfect for developer profiles

:::tip
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
:::tip
:::note

Not 100% sure we support tip, will find out and edit

@kodster28
Copy link
Collaborator

This PR has been sitting for quite a while without any updates (or response to the comments dropped by @Oxyjun).

Going to close it out for now. If you want to continue with the work, you'll need to make a new one.

@kodster28 kodster28 closed this May 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

developer-spotlight DevRel Tasks that need support from developer relations. product:workers Related to Workers product size/xl

Projects

None yet

Development

Successfully merging this pull request may close these issues.