October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk8 min

Generate Hindi News Article Thumbnails from URLs with PHP and Headless Chrome

A practical PHP guide to capturing article URLs with headless Chrome, choosing thumbnail framing and formats, ensuring Hindi fonts render, and handling timeouts and URL security.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use PHP’s chrome-php/chrome library to launch Chrome or Chromium, open an article URL, wait for the page and Hindi fonts to render, then save a deliberately framed screenshot. Set the viewport and crop for the destination you publish to; there is no single correct thumbnail size when the platform is unspecified.

What the workflow does

A URL-to-thumbnail pipeline has two distinct parts: rendering the source page and deciding what the thumbnail should show. A browser screenshot captures the page as rendered; it does not automatically extract the headline, select a representative image, or compose a designed news card. If you want a branded thumbnail with a headline overlay, build that composition in your own HTML and capture it, or create an image from extracted article data.

As an Amazon Associate I earn from qualifying purchases.

The example below captures the article page itself at a fixed viewport. The output path and viewport are configurable. It uses the chrome-php/chrome project, whose README documents Composer installation, browser launch, navigation and screenshot saving.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Install PHP and Chrome support

Requirements

Install PHP, Composer, and Chrome or Chromium in the environment where the PHP process will run. The project README lists PHP 7.4–8.5 and Chrome/Chromium 65 or later as requirements when checked; confirm the current README and your installed versions before deployment because compatibility can change.

#1 Best Overall
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB
  • CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
  • WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
  • A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents

Install the library

composer require chrome-php/chrome

The PHP process must be able to start the browser executable. In a container or server, check that Chrome/Chromium and its runtime dependencies are installed and that the service account has permission to launch it.

Capture an article page in PHP

This complete example validates the URL scheme, starts a browser, opens a fresh page, sets a 1200 × 675 viewport, waits for page navigation, waits for fonts and images to settle within a bounded period, and saves a JPEG. The dimensions are an example composition, not a universal platform requirement. Change them to match the publishing destination and your layout.

<?php
require __DIR__ . '/vendor/autoload.php';

use HeadlessChromiumBrowserFactory;

$url = $argv[1] ?? '';
$output = $argv[2] ?? __DIR__ . '/thumbnail.jpg';

$parts = parse_url($url);
if ($parts === false || !isset($parts['scheme'], $parts['host']) ||
    !in_array(strtolower($parts['scheme']), ['http', 'https'], true)) {
    fwrite(STDERR, "Usage: php thumbnail.php https://example.com/article [output.jpg]n");
    exit(2);
}

$browser = null;
try {
    $browserFactory = new BrowserFactory();
    $browser = $browserFactory->createBrowser();
    $page = $browser->createPage();
    $page->setViewport(1200, 675);

    $page->navigate($url)->waitForNavigation(
        HeadlessChromiumPagePage::LOAD,
        30000
    );

    // Wait for document fonts and currently discovered images, but do not
    // let an indefinitely loading page hold the worker forever.
    $page->evaluate('''
        (async () => {
            if (document.fonts && document.fonts.ready) {
                await document.fonts.ready;
            }
            const images = Array.from(document.images);
            await Promise.all(images.map(img => {
                if (img.complete) return Promise.resolve();
                return new Promise(resolve => {
                    img.addEventListener('load', resolve, { once: true });
                    img.addEventListener('error', resolve, { once: true });
                    setTimeout(resolve, 5000);
                });
            }));
        })()
    ''')->waitForResponse(10000);

    $page->screenshot([
        'format' => 'jpeg',
        'quality' => 85,
    ])->saveToFile($output);

    fwrite(STDOUT, "Saved thumbnail to {$output}n");
} catch (Throwable $e) {
    fwrite(STDERR, "Thumbnail capture failed: {$e->getMessage()}n");
    exit(1);
} finally {
    if ($browser !== null) {
        $browser->close();
    }
}

Run it with an article URL and, optionally, an output filename:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Philips 22 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 221V8LB
  • CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
  • SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
php thumbnail.php 'https://example.com/news/hindi-article' ./article-thumbnail.jpg

The library documents navigation waits, screenshot formats and quality options in its README. Verify the exact API signatures against the version installed by Composer; package releases can differ. The font-and-image readiness check is intentionally bounded and treats failed images as settled so one broken asset does not block the capture indefinitely.

Choose framing and output format

Viewport capture

A viewport screenshot captures the visible browser area. Use it when the thumbnail is meant to show the page header, lead image, or a designed card at a fixed size. Set the viewport before navigation or capture and keep it consistent between jobs to make framing repeatable.

Clipped capture

A clip rectangle captures a defined region rather than the entire visible viewport. This is useful when the target is a particular element or the composition is positioned within a larger page. Measure the rectangle in CSS pixels and ensure it includes the desired content at the chosen device scale.

Rank #3
Dell 24 Monitor - SE2426H - 23.8-inch FHD (1920x1080) 144Hz 1ms Display, in-Plane Switching (IPS) Technology, AMD FreeSync™, TÜV 3-Star 2X HDMI, Tilt
  • Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
  • Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
  • Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
  • In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
  • Ultra-thin bezels: Maximize your viewing experience with thin bezels.

Full-page capture

Full-page mode captures beyond the initial viewport and is useful for page archives or inspection. It is often a poor default for a thumbnail: a long article becomes a tall image that must be reduced or cropped, making its headline and imagery difficult to read. The library documents full-page capture using a full-page clip with captureBeyondViewport.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

PNG, JPEG, or WebP

Format Useful when Trade-off
PNG You need lossless capture or crisp text and flat graphics. Files can be larger than lossy alternatives.
JPEG The screenshot is primarily photographic and broad compatibility is useful. Compression can introduce artifacts around text and sharp edges.
WebP Your publishing pipeline accepts it and you want a modern compressed image format. Confirm the destination supports WebP before relying on it.

The PHP library and Chrome DevTools Protocol document PNG, JPEG and WebP capture. Choose the format and quality for the actual destination rather than assuming that one format fits every publishing system.

Make Hindi text render consistently

For Hindi sans-serif text, use Noto Sans Devanagari and provide suitable fallbacks for punctuation, digits and other characters. Noto’s guidance recommends the script-specific family together with the corresponding style from the main Noto Sans family for characters outside Devanagari. A CSS stack can look like this:

Rank #4
Sale
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor | 100Hz, Game Mode, Advanced Eye Comfort, HDMI and D-sub Ports (LS27D366GANXZA)
  • CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
  • SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
  • MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
  • KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
  • INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient
body {
  font-family: "Noto Sans Devanagari", "Noto Sans", sans-serif;
}

Make the required font available in the browser environment when possible. If the page loads a remote web font, wait for document.fonts.ready before capturing: Chrome may render the rest of the page while leaving text that depends on a not-yet-loaded font blank. Inspect the Hindi text at the final thumbnail size; a font that loads correctly can still be too small or poorly framed for the intended use.

For a composed thumbnail rather than a screenshot of the source page, create a local HTML card with the headline and image, set the desired viewport, and capture that card. This makes headline wrapping, font size and crop deterministic, instead of relying on each source article’s layout.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Wait strategy and time limits

The project documents a 30-second default wait for the load navigation event and supports alternative navigation events and timeouts. Waiting for the full load event is straightforward but may be slow on pages with many resources. A faster navigation event can be appropriate for a controlled site if your code then explicitly checks for the content, images and fonts the thumbnail needs. Do not replace readiness checks with an arbitrary short sleep: network and rendering time vary.

Best Value
Sale
Sceptre New 22-Inch Gaming Monitor, FHD 1080p, Up to 144Hz, HDMI, DisplayPort, Built-in Speakers, Machine Black (E225W-FW144 Series, 2026)
  • 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
  • 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
  • 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.
  • Set a maximum navigation duration and a separate bound for post-navigation readiness checks.
  • Decide what counts as success: for example, the title or lead image is present, fonts are ready, and the page is not blank.
  • Close the browser in cleanup logic even when navigation or capture throws an error.
  • Record a clear failure result for timeouts or navigation replacement rather than silently returning an empty image.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Security when URLs come from users

A public URL-to-image endpoint is also a server-side URL fetcher. Validating that a string begins with http is not sufficient protection. A malicious or mistaken request could target internal services or private network addresses reachable from the server. Before exposing this workflow, implement a security policy for destination validation and network access, isolate browser processes, keep Chrome updated, and enforce resource and execution limits. Headless mode alone does not make arbitrary URL fetching safe.

  • Allow only the URL schemes and destinations your service needs; reject unexpected schemes and malformed input.
  • Block access to loopback, private, link-local and internal network destinations at the network boundary, including after redirects and DNS resolution.
  • Run browser jobs in an isolated, least-privilege environment with bounded CPU, memory, time and output size.
  • Use controlled output paths rather than incorporating untrusted URL text into filesystem paths.

Troubleshooting

Symptom Likely cause What to check
Chrome does not start Browser executable or runtime dependencies are missing, or the service account cannot launch it. Confirm Chrome/Chromium installation, executable availability, permissions and container dependencies.
Navigation times out The page is slow, blocked, or never reaches the selected navigation event. Use a bounded timeout, inspect the target in the same environment, and consider a different navigation event followed by explicit content checks.
Hindi text is blank or uses the wrong glyphs The font is not installed, a remote font has not loaded, or fallback coverage is incomplete. Make Noto Sans Devanagari available, define fallbacks, wait for fonts, and inspect the rendered output.
Image is mostly blank despite navigation completing Rendering may be delayed, blocked, or the page may not have produced expected content. Check for the article title or lead image before capture and treat missing required content as a failed job.
Thumbnail crops the wrong area The viewport or clip does not match the intended composition. Set the viewport deliberately, use a clip for a known region, and avoid full-page mode unless a tall capture is intended.
Browser processes remain after failed jobs Cleanup did not run after an exception or worker termination. Close the browser in a finally block and enforce an external process timeout for jobs that may be killed.

Performance, reliability, and cost

Each capture requires browser startup, page navigation and rendering, so a service should bound concurrency and reuse infrastructure carefully. A fresh page per job helps separate page state, while browser reuse can reduce repeated startup work but requires robust cleanup and isolation. No universal speed or cost figure follows from the capture method: actual timing and resource use depend on the page, browser environment, network and chosen readiness criteria.

For repeatable output, pin and track your PHP package and Chrome/Chromium versions, keep browser updates in your maintenance process, and log the target, duration, format and failure reason without exposing secrets in URLs or headers. Validate the resulting image dimensions and file size before handing it to the publishing pipeline.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Or skip the browser setup

ScreenshotNeo offers a one-request screenshot API and an MCP server for AI agents. It can remove cookie/consent banners, newsletter popups and chat widgets before capture; those cleanup steps can also be turned off. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed, with response headers indicating the page verdict and billing status. An MCP server provides take_screenshot, get_page_info and capture_pdf tools for Claude, Cursor and other MCP clients. Its free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots.

For a simple URL capture, the API call is:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com/news/hindi-article -o shot.webp

See the ScreenshotNeo API documentation for supported parameters and response details. Sign up free for 1,000 screenshots a month, with no card required.

Sources and compatibility notes

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.