# Codex ImageGen Lab for a Responsive Next.js Hero

> Build a responsive Next.js hero with a supplied Codex ImageGen asset, verify the image crop and HTML booking action, and compare both language layouts.

URL: https://www.matthewswong.com/en/learn/web-app-skills/codex-imagegen-responsive-hero-lab/

Web app skills · Lesson 12 of 12 · Reviewed on 3 December 2026 · By Matthews Wong (https://www.matthewswong.com/en/about/)

> A responsive Next.js hero combines an image whose subject survives cropping with HTML copy and a reachable action. In this lab you reuse a bicycle-workshop image generated with Codex ImageGen, then check a mobile and desktop booking layout in English and Indonesian. You can complete the layout exercise with the supplied asset.

## You will be able to

- Translate a website image brief into a crop decision.
- Check responsive image delivery and keyboard reachability on both locales.

## Codex ImageGen Lab for a Responsive Next.js Hero

A responsive Next.js hero combines an image whose subject survives cropping with HTML copy and a reachable action. In this lab you reuse a bicycle-workshop image generated with Codex ImageGen, then check a mobile and desktop booking layout in English and Indonesian. You can complete the layout exercise with the supplied asset.

1. **Choose the focal point.** Find the mechanic’s hands and the bicycle’s gears in the supplied image.
2. **Reserve space.** Use a sized container and let the copy wrap as normal HTML.
3. **Preview both crops.** Compare the narrow hero to the desktop view. Use the longer Indonesian heading for the layout check.

   *Predict:* What keeps the booking button adaptable across locales? (The source file extension / A larger image export / HTML copy and a native link)
4. **Reach the booking action.** Press Tab until the main action receives focus, then activate it and inspect the destination.
5. **Check delivered image bytes.** Use the browser network panel to confirm a mobile image request fits the layout.

## Prepare the image and HTML

Open the flagship comparison to see the 1200×800 workshop image. The hands and drivetrain establish what the shop does. In your layout, use the image as a visual beside a heading and a booking link to a section within the same page.

If ImageGen is available in your Codex surface, try generating a second version from the saved brief in the article. The supplied asset remains available for practising the same implementation and browser checks.

## Inspect mobile first, then compare desktop

Start at 390 CSS pixels and check whether the mechanic’s hands and the booking action remain legible. Try both languages at the same width before comparing a desktop viewport.

## The real config behind this lesson

`lib/blog-figures.ts`

```ts
  "codex-imagegen-bicycle-workshop": {
    src: "/images/blog/inline/codex-imagegen-bicycle-workshop.jpg",
    width: 1200,
    height: 800,
```

The live article uses this source and intrinsic size. Reuse that path in your lab before adjusting the way the image fits its container.

## What breaks

- **The phone crop loses the repair.** Adjust object position or provide a separate crop. Capture the new phone view and confirm the gear and wrench are visible.
- **The booking link is visible but hard to reach.** Tab through the headline region and ensure the native link receives a visible focus indicator and leads to the booking section.

## Try it yourself

Use a local Next.js checkout. The article contains the exact asset and can be opened in both languages while you work.

1. Create a scratch page at app/[locale]/(pages)/imagegen-lab/page.tsx. Build a hero with the supplied asset and a booking link to a section with id booking. Supply “Book a bicycle service” in English and “Jadwalkan servis sepeda Anda” in Indonesian.
2. Start the local server. Open /en/imagegen-lab and /id/imagegen-lab at 390 and 1280 CSS pixels. Capture the crop and activate the booking link with a keyboard.

   ```bash
   npm run dev
   ```
3. Use the network panel at 390 pixels to inspect the resource selected for Next.js Image. Compare it after changing sizes to reflect the actual layout.

## Quick quiz

1. **What keeps the booking button adaptable across locales?**
   A. The source file extension
   B. A larger image export
   C. HTML copy and a native link
   Answer: C. HTML copy can wrap and the native link supports keyboard activation.

2. **Where should the mobile crop be checked?**
   A. In the rendered page at the intended width
   B. Only in the original image at full size
   C. Only from build output
   Answer: A. The page’s aspect ratio and object position determine what the phone displays.

3. **What does sizes describe to the browser?**
   A. The text language
   B. Expected rendered image width
   C. The alt text
   Answer: B. The approximate display width helps the browser choose a source candidate for its viewport.

## Think it through

- **Where should the mobile crop be checked?** The page’s aspect ratio and object position determine what the phone displays.
- **What does sizes describe to the browser?** The approximate display width helps the browser choose a source candidate for its viewport.

## Go deeper

- [Codex vs Claude Code for Websites with ImageGen](https://www.matthewswong.com/en/blog/codex-vs-claude-code-for-websites-imagegen/)
- [Ship Codex-Generated Images Through Next.js Image](https://www.matthewswong.com/en/blog/codex-generated-images-nextjs-pipeline/)
- [Review a Codex ImageGen Hero in English and Indonesian](https://www.matthewswong.com/en/blog/codex-imagegen-bilingual-hero-review/)

## Sources

- [Next.js Image documentation](https://nextjs.org/docs/app/api-reference/components/image)
- [OpenAI on Codex image generation and browser use](https://openai.com/index/codex-for-almost-everything/)

---

- HTML version: https://www.matthewswong.com/en/learn/web-app-skills/codex-imagegen-responsive-hero-lab/
- Bahasa Indonesia: https://www.matthewswong.com/id/learn/web-app-skills/codex-imagegen-responsive-hero-lab/
- Site index for agents: https://www.matthewswong.com/llms.txt
- Sitemap: https://www.matthewswong.com/sitemap.xml
- API description (OpenAPI): https://www.matthewswong.com/openapi.json
