OnlineFreeTools.org
  • Home
  • Tools
    Health & body →
    BMI Calculator — How to Calculate Body Mass IndexBMR & TDEE Calculator — How to Calculate Daily CaloriesBody Fat Calculator — How to Estimate Body Fat PercentageHeart Rate Zone CalculatorIdeal Weight Calculator — How to Estimate Ideal Body WeightMacro Calculator — Calories to Protein Carb Fat GramsOne-Rep Max Calculator (Epley)Pace Calculator — min/km and Speed
    Personal money →
    CAGR Calculator — How to Calculate Compound Annual Growth RateCompound Interest Calculator — How to Calculate Future ValueDebt Payoff Calculator — Months to Clear a BalanceDiscount Calculator — How to Calculate Sale PriceEMI Calculator — How to Calculate Loan PaymentsInflation Calculator — Future Purchasing PowerPercentage Change Calculator — From Old Value to NewPresent Value Calculator — PV and FV ModesRule of 72 Calculator — Years to DoubleSalary to Hourly Calculator — How to Convert Pay RatesTip Calculator — Tip Amount and SplitVAT / GST Calculator — Add or Extract Tax
    Business finance →
    Break-Even Calculator — How to Calculate Break-Even PointContribution Margin Calculator — Price Minus Variable CostGross Margin Calculator — How to Calculate Gross MarginIRR Calculator — Internal Rate of ReturnHow to Calculate Marginal Revenue — MR Calculator (ΔTR / ΔQ)Markup Calculator — How to Calculate Markup PercentageHow to Calculate NPV — Net Present Value CalculatorPayback Period Calculator — Years to Recover InvestmentProfit Margin Calculator — Net or Operating MarginROI Calculator — How to Calculate Return on Investment
    Math & stats →
    Confidence Interval Calculator — How to Calculate a CIExponent Calculator — How to Calculate PowersGPA Calculator — How to Calculate Weighted GPALogarithm Calculator — How to Calculate LogsMean Calculator — Average of a Number ListMedian and Mode CalculatorP-Value Calculator — How to Calculate a P-ValuePermutation and Combination CalculatorQuadratic Equation Solver — Roots and DiscriminantSample Size Calculator — How to Estimate Required nScientific Notation Calculator — How to Convert Scientific NotationSignificant Figures Calculator — How to Count and Round Sig FigsStandard Deviation Calculator — How to Calculate SD and VarianceZ-Score Calculator — How to Calculate a Standard Score
    Geometry & measure →
    Aspect Ratio Calculator — How to Calculate and Scale RatiosCircle Calculator — Area and CircumferenceGradient Calculator — Multivariable ∇f (Partial Derivatives)Pythagorean Theorem Calculator — How to Find a Missing SideSlope Calculator — How to Calculate Slope Between Two PointsTriangle Area CalculatorVolume Calculator — Box and SphereUnit Converter — Length / Mass / Temperature / Area / Volume / Speed
    Science & physics →
    Acceleration Calculator — Change in VelocityDensity Calculator — Mass over VolumeOhm’s Law Calculator — Resistance and PowerVelocity Calculator — Distance over TimeMeasuring Magnetic Fields — Field strength calculator
    Home & DIY →
    Concrete Calculator — How to Estimate Concrete VolumePaint Calculator — How to Estimate Paint NeededTile Calculator — How to Estimate Tile QuantitySquare Feet to Square Meters — Area Converter for Homes & Renovation
    Time & calendar →
    Age Calculator — Chronological Age from BirthdateDate Difference Calculator — Days and WeeksTime Zone Converter — Compare One Moment WorldwideUnix Timestamp Converter — Epoch ↔ Readable Time
    PDF & docs →
    Add a digital signature to a PDFAdd text to a PDF fileBatch compress PDFs for emailCheck PDF/A complianceCombine files into one PDFCompare two PDFsReduce PDF file sizeConvert HTML to PDFConvert PDF to DWGConvert PDF to PDF/AConvert Word document to PDFCreate a PDF formCrop PDF — Trim Page Margins in Your BrowserEdit PDF form fieldsEdit PDF text onlineExtract text from a PDFFill out a PDF formMake a PDF fillableMake a PDF flipbookCombine PDF files into oneOpen a PDF in the browserOrganize PDF — Reorder or Remove Pages in Your BrowserAdd Page Numbers to PDF — In Your BrowserPDF Page to Image Sizes — Multi-Size Export PackConvert PDF pages to JPGPDF to Markdown — Extract Text for Notes in Your BrowserPDF Watermark — Stamp Text on Every Page in Your BrowserPrint a PDFPassword-protect a PDFRotate PDF — Fix Page Orientation in Your BrowserSign a PDF documentSplit my PDFTurn PDF into an editable documentTurn PDF into Word documentUnlock my PDFWrite a PDF document online
    Image & media →
    Add Text Watermark to Photo — Local Browser ToolAmazon main image sizeApple-touch-icon 180×180Batch watermark product photosBulk compress PNG imagesBulk compress product photos (JPEG, PNG, WebP)Bulk convert images to JPGBulk convert images to PNGBulk convert images to WebPExtract Colors from Image — Palette & Click PickFlip Image — Mirror Horizontally or VerticallyAdd Border to Image — Color & Width OnlineImage Compressor — Resize, Quality & Target Size LocalCrop & Resize Image — Local Aspect PresetsPhoto EXIF Viewer & Remover — GPS, Camera & Local StripImage Format Converter — PNG JPEG WebP AVIF BMP GIF ICO SVGConvert Image to Grayscale — Black & White OnlineMerge Images — Combine Photos into One CollageImage Optimizer — WebP, AVIF & MozJPEG LocalOverlay Images — Put a Logo on a PhotoImage to Base64 Converter — Encode & Decode LocallyImages to GIF — Make an Animated GIF LocallyTurn JPG into PDFImages to PowerPoint — Photos to PPTX SlidesImages to Word — Build a DOCX from PhotosInstagram post sizeInstagram story sizeiOS app icon sizeiPhone 6.9 screenshot sizeLinkedIn banner sizeOpen Graph image sizeSVG optimizerYouTube thumbnail size
    Design & brand →
    Generate Brand Color Scale — 50–950 Palette & CSS TokensBrand Style Guide — Generate a Modular Draft You Can EditSmart Website Color Scheme — Semantic CSS TokensWCAG Contrast Checker — AA/AAA Ratio Online
    SEO & growth →
    Check if a URL is blocked by robots.txtCheck SSL certificate expirationCore Web Vitals CheckerFind and validate XML sitemapHreflang GeneratorIndexNow — Bing URL Submit, Key Check & Status CodesGoogle SERP PreviewMeta Tag GeneratorOn-Page SEO CheckerOpen Graph PreviewRobots.txt GeneratorJSON-LD Schema GeneratorXML Sitemap GeneratorSPF DKIM DMARC checkerUTM BuilderValidate security.txt
    Network & IP →
    Add WWW to DNS — A/CNAME, Apex Rules & Provider GuidesAWS VPC CIDR planner — Split a VPC into AZ subnetsCIDR cheat sheet — Click a prefix to see mask and hostsCIDR to IP range — Expand a prefix into usable addressesDomain Lookup — Check DNS Records & Registration OnlineWhat Is My IP Address — See Your Public IP (IPv4 or IPv6)IP range to CIDR — Turn start–end addresses into prefix listsIPv6 CIDR calculator — Expand a prefix into its address rangePrivate CIDR ranges — Check if an IP or prefix is private or special-useTerraform cidrsubnet — Get the child CIDR Terraform would returnCheck HTTP Response Headers
    Dev & data →
    Base64 Encode & Decode — Convert Text in Your BrowserChatGPT export to MarkdownCSV ↔ JSON Converter — Types, Delimiters & Localcurl to fetchHTML Entity Encoder & Decoder — Escape, Unescape & LocalJSON Schema Validator — Draft-07 Paths & LocalJWT Decoder — Read Header & Payload Locally (No Verify)Markdown ↔ HTMLYAML ↔ JSON Converter — Types, Multi-doc & Local
    AI prompt tools →
    Android prompt builder — Local + Optional AIFilm prompt builder — Local + Optional AIiOS prompt builder — Local + Optional AIMidjourney prompt builder — Local + Optional AIProduct design prompt builder — Local + Optional AIPrompt template builder — Local + Optional AIShort drama prompt generator — Local + Optional AISketch.app prompt generator — Local + Optional AIWriting prompt generator — Local + Optional AI
    Text compare →
    Compare two text files onlineCompare two Word documents for differencesExcel compare filesJSON diff checker onlineCheck difference between two texts
    Security & IDs →
    Batch checksum release filesFile Hash Checker — Verify Digests in Your BrowserFile metadata analyzerRandom Password Generator — Create Passwords LocallyUUID & ULID Generator — Create IDs in Your Browser
    Files & archives →
    Archive Extractor Online — Open Compressed Files in Your BrowserCreate zip fileMagnet Link Decoder — Parse Info Hash and Trackers LocallyUnzip File Online — Extract ZIP Files in Your Browser
  • Tool topics
  • Tool types
  • Dev Logs
☕ Buy me a coffee

Navigation

Home

Tool OG bitmaps now live on the public R2 bucket `assets` at `https://assets.onlinefreetools.org/og/tools/{slug}.webp`; GitHub→Cloudflare no longer ships those files as Worker Assets. | Dev Logs

Back to Logs

Date: 2026-09-04 08:46 Summary: Tool OG bitmaps now live on the public R2 bucket assets at https://assets.onlinefreetools.org/og/tools/{slug}.webp; GitHub→Cloudflare no longer ships those files as Worker Assets. Visibility: people

[question] 已经在R2上创建assets桶,并将assets.onlinefreetools.org指向这个存储,创建脚本,将 public/og/tools 的图片upload上去,并将页面图片访问链接进行同步修改.同时在同步到github后,不要将这些图片同步到cloudflare上。

[try to solve]

Context

Per-slug SERP/OG screenshots already live in public/og/tools/*.webp and were previously destined for Worker Static Assets (https://onlinefreetools.org/og/tools/…). The operator created a dedicated R2 bucket assets with custom domain assets.onlinefreetools.org so those bitmaps can stay in Git as source, be served from R2, and not be bundled into the GitHub → Cloudflare Worker Assets deploy.

Process

  1. Reused the existing R2 S3 client (scripts/lib/r2-s3-client.mjs) and added optional CacheControl on PutObject.
  2. Added scripts/upload-r2-og-assets.mjs + npm scripts upload:r2:og / upload:r2:og:full. Object keys match the public path: og/tools/{slug}.webp → https://assets.onlinefreetools.org/og/tools/{slug}.webp. Incremental uploads compare sha256 against _meta/og-tools-manifest.json (and local .cache/og-tools-upload.json). Dry-run does not write that local manifest.
  3. Pointed page URLs at the CDN in src/pages/site/ogImage.ts (OG_ASSETS_BASE_URL). Visible <img>, og:image / twitter:image, and JSON-LD already go through resolveToolOgImageUrl, so they stay on the same absolute URL. organize-pdf no longer strips the apex host to a same-origin path.
  4. Excluded the directory from Worker Assets with og/tools/ in public/.assetsignore. Files remain Git-tracked (capture source); Cloudflare’s Git deploy skips them the same way it skips _pages/.
  5. Hooked OG upload into npm run deploy (after HTML upload:r2).
  6. First S3 PutObject to bucket assets returned 403 because the existing R2 API token is scoped to onlinefreetools-pages. wrangler r2 object put --remote succeeded (account OAuth). The script now probes S3 once and falls back to wrangler (concurrency capped at 6).
  7. Uploaded 74 images. Live check: GET https://assets.onlinefreetools.org/og/tools/merge-pdf.webp → 200, content-type: image/webp, cache-control: public, max-age=2592000. Resolver check: merge-pdf → CDN URL; unknown slug → apex og-image.png.

Root cause / analysis

Worker Assets are sized by the Git-connected deploy of public/ minus .assetsignore. OG screenshots are large, change independently of Worker code, and already have a public custom domain on a separate bucket — they belong on that bucket, not in the Worker asset bundle.

S3 vs wrangler: HTML upload uses an R2 S3 token often limited to onlinefreetools-pages. The new public bucket needs the same token’s Object Read & Write (or the wrangler fallback). Expanding the token is the fast path; wrangler is the working path today.

Do not gitignore public/og/tools/: the request was “after syncing to GitHub, do not sync these images to Cloudflare”, which is .assetsignore, not omitting the files from the repo.

Solution

Piece Behavior
Source public/og/tools/{slug}.webp stays in Git
Cloudflare Worker Assets Excluded via public/.assetsignore → og/tools/
Public URL https://assets.onlinefreetools.org/og/tools/{slug}.webp
Upload npm run upload:r2:og (S3, wrangler fallback on 403)
Page wiring resolveToolOgImageUrl / layout / JSON-LD / visible <img>
Default fallback Apex https://onlinefreetools.org/og-image.png (still Assets)

Ship HTML after this change: npm run build:site then npm run upload:r2 before git push. Otherwise prerendered pages still point at /og/tools/ on the apex host, and that path 404s once .assetsignore is live.

Notes / boundaries

  • Grant the R2 S3 token Read & Write on bucket assets to drop the wrangler fallback (ops/worker-r2-ops.md §3.2).
  • Same-key image replacements may stay at the edge for up to 30 days (max-age=2592000); purge the custom-domain cache or wait.
  • Local wrangler dev will not serve /og/tools/ from Assets; tool pages load the production CDN URL.
  • _meta/og-tools-manifest.json is also on the public bucket (filenames + hashes only).

[actions]

  • Added scripts/upload-r2-og-assets.mjs; npm upload:r2:og / upload:r2:og:full; deploy runs OG upload after HTML
  • Updated src/pages/site/ogImage.ts, organizePdfPage.ts, scripts/lib/r2-s3-client.mjs, public/.assetsignore
  • Documented in ops/worker-r2-ops.md §3.2, docs/worker+R2架构/design.md, cloudflare-workflow.mdc, SERP image plan
  • Uploaded 74 objects to R2 bucket assets (wrangler fallback)
OnlineFreeTools.org · Learning project · Iterating
About·Privacy·Terms·Contact·GitHub