Skip to content

Use local override thumbnails and SVG placeholder; remove Google image fallbacks#7

Open
ethan-CCY wants to merge 1 commit intomainfrom
codex/fix-kh_parking-image-display-issues
Open

Use local override thumbnails and SVG placeholder; remove Google image fallbacks#7
ethan-CCY wants to merge 1 commit intomainfrom
codex/fix-kh_parking-image-display-issues

Conversation

@ethan-CCY
Copy link
Owner

Motivation

  • 停止前端呼叫任何 Google 圖片 API,避免需要 API Key 與被擋造成的空白縮圖或 ERR_BLOCKED_BY_ORB 錯誤。
  • 圖片來源改為 overrides.json 的本地圖片欄位 thumbnail_url,若無提供則顯示內建 placeholder。
  • 保持前端圖片處理為純靜態、零外部 API 呼叫以便 GitHub Pages 直接可用。

Description

  • normalizeItem 補入 thumbnailLocalUrl 屬性並保持 thumbnail 結構不依賴 Google 返回的欄位。
  • 在合併 overrides 時把 ov.thumbnail_url 轉存到 item.thumbnailLocalUrlinitialize())。
  • getThumbnailUrl(item) 簡化為僅返回 item.thumbnailLocalUrlnull,並移除 Place Photo / Street View / maps.googleapis.com 相關邏輯與模板處理。
  • renderList() 現在不論是否有圖都渲染一個 <img>,使用內嵌 PLACEHOLDER_IMAGE(SVG data URI)作為預設或在 onerror 時回退為 placeholder。

Testing

  • 啟動本地靜態伺服器 python -m http.server 8000 並載入首頁以驗證頁面可正常呈現。
  • 使用 Playwright 腳本遠端截圖頁面(輸出 artifact artifacts/thumbnail-placeholder.png)以確認有縮圖或 placeholder 正確顯示,腳本執行成功。

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant