Communitygithub.com

brainzcode/premium-landing

從 Unsplash 尋找免版權、授權清晰的攝影作品 — 根據氛圍而非名詞搜尋,裁剪成適合的尺寸,遵守 API 的熱連結和下載追蹤要求,並撰寫真正的替代文字。

premium-landing 是什麼?

這個工具專為需要高品質圖像的網站而設計,尤其適用於登陸頁面、英雄圖片、區塊配圖、頭像或卡片藝術。它解決了從 Unsplash 取得免費商用攝影作品的完整流程:取得 API 金鑰、根據設計氛圍而非字面名詞搜尋、遵守 Unsplash API 的熱連結和下載追蹤規則、處理圖片尺寸與裁剪、以及撰寫語意正確的替代文字(alt text)。支援無金鑰的圖片 CDN 直接使用(若已知圖片 ID),以及透過 API 金鑰進行搜尋。此工具明確指出已淘汰的 `source.unsplash.com` 端點,並提供實際可行的替代方案。其輸出可與 `../landing-page/references/traps.md` 中的裁剪邏輯搭配使用,確保圖片主體在設計中不會被錯誤裁切。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/brainzcode/premium-landing/tree/HEAD/plugins/premium-landing/skills/stock-imagery

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

庫存圖片

一個英雄圖片區塊只有灰色佔位符的登陸頁面,等於尚未完成。本技能涵蓋如何尋找可免費商用的真實攝影作品,使其符合設計,且在他人載入頁面時不會出錯。

每個人都先嘗試的端點已經失效

https://source.unsplash.com/1600x900/?coffee     →  HTTP 503

source.unsplash.com — 這個無需金鑰的隨機圖片端點 — 已經退役。它仍然散落在許多部落格文章和舊模板中,現在回傳 503。如果你在程式碼中找到它,代表一個破圖,而非可用的圖片。

無需金鑰且真正有效的方式是,當你已經知道圖片 ID 時,使用 CDN:

https://images.unsplash.com/photo-1447933601403-0c6688de566e?auto=format&fit=crop&w=1600&q=80

這會回傳真實圖片。但沒有金鑰你無法搜尋,而且瞎猜圖片 ID 也行不通。所以:

取得金鑰(兩分鐘,免費)

  1. https://unsplash.com/oauth/applications → 新增應用程式 → 接受條款
  2. 複製存取金鑰
  3. 匯出它 — 絕對不要提交到版本控制:
export UNSPLASH_ACCESS_KEY="your_access_key"

示範級別每小時 50 個請求,對一個登陸頁面來說非常充裕。如果使用者沒有金鑰,請告知並要求提供 — 不要默默地回退到灰色方塊,也不要憑空偽造 URL。

curl -s -H "Authorization: Client-ID $UNSPLASH_ACCESS_KEY" \
  "https://api.unsplash.com/search/photos?query=coastal+fog&orientation=landscape&per_page=8" \
| python3 -c "
import json,sys
for p in json.load(sys.stdin)['results']:
    print(p['id'], p['width'], p['height'], '|', (p.get('alt_description') or '')[:60])
    print('   ', p['urls']['raw'])
    print('   ', p['user']['name'], p['links']['download_location'])
"

兩個容易忽略的 API 規則

1. 直接熱連結 API 回傳的 URL。 Unsplash API 條款要求使用他們的 CDN URL,而不是重新託管檔案。這與一般建議的提供本地最佳化資源的做法衝突,但在使用 API 時,條款優先。如果客戶需要自託管檔案,請透過 Unsplash+ 授權圖片或從其他地方購買 — 不要悄悄重新託管並期望沒事。

2. 當圖片實際被使用時,觸發下載端點。 不是預覽時,而是正式上線時。這是攝影師獲得使用記錄的方式,也是 API 的條件,而非禮貌性的要求。

curl -s -H "Authorization: Client-ID $UNSPLASH_ACCESS_KEY" \
  "$DOWNLOAD_LOCATION"   # 從搜尋結果取得的 links.download_location 值

授權範圍

Unsplash 授權允許商業和非商業用途,無需許可,也無需強制署名。它不允許銷售未經修改的副本,也不允許建立一個與之競爭的圖片服務。照片中可能包含可識別的人物、商標或藝術作品 — Unsplash 不清除人物或財產肖像權,因此對於任何暗示背書的內容(例如看起來像顧客的人、推薦照片),請改用已取得肖像權的圖片。

雖然不強制要求署名,但花一行字做到是正確的做法:

<!-- Photo: Jane Doe / Unsplash -->

明智的選擇

直接搜尋字面上的名詞會讓頁面看起來像套版。搜尋 "Coffee" 會得到一萬張一模一樣的拿鐵俯拍圖。

搜尋氛圍,而非主題。 對於咖啡烘焙坊:warm industrial workshop、hands working、morning light interior。對於財富管理顧問:still architecture、quiet minimal interior、long shadows。

然後根據設計實際上會限制的三件事進行篩選:

  • 方向與主體位置。 使用 object-fit: cover 裁剪的英雄圖片,需要主體偏離中心或有足夠的頭部空間,否則裁剪會導致主體被切頭。在選擇前檢查主體位置 — 取景的計算方式請參閱 ../landing-page/references/traps.md。
  • 色調範圍。 疊加的文字需要其背景區域始終保持明亮或始終保持暗色。一張雜亂的中间色調照片會讓任何文字顏色都顯得突兀。
  • 同一攝影師,或統一風格。 一個區塊中使用三位攝影師的三張圖片會讓人感覺像圖庫素材。偏好來自同一組拍攝的多張圖片,或是色調一致的圖片。

尺寸

Unsplash CDN 參數負責調整大小,因此要求你實際顯示的尺寸即可:

?auto=format&fit=crop&w=1600&q=80        英雄圖片
?auto=format&fit=crop&w=800&q=80         卡片
?auto=format&fit=crop&w=192&h=192&q=80   頭像(正方形)

auto=format 會對支援的瀏覽器提供 WebP/AVIF 格式。對於響應式英雄圖片,請輸出 800/1200/1600/2000 的 srcset,而不是將一張 2000px 的圖片發送給手機。

替代文字

alt 描述圖片顯示的內容,給無法看到圖片的人。它不是關鍵字插槽,也不是圖片標題。

<!-- 錯誤 -->
<img alt="coffee roastery landing page hero image">
<!-- 正確 -->
<img alt="Roaster tipping green beans into a drum roaster in a workshop">

如果圖片只是裝飾用,而且周圍的文字已經說明了所有內容,請使用 alt="" 以便螢幕閱讀器略過它。空的 alt 是正確的;缺少 alt 則不然。

檢查清單

  • UNSPLASH_ACCESS_KEY 已設定,且絕不提交
  • 搜尋氛圍,而非字面名詞
  • 已根據區塊裁剪方式檢查主體位置
  • 色調範圍在疊加任何文字下都能正常顯示
  • 同一區塊的圖片風格一致
  • 按照 API 要求使用 CDN URL 熱連結 — 非重新託管
  • 每張上線的圖片都已觸發 download_location
  • 尺寸參數符合顯示尺寸;響應式英雄圖片使用 srcset
  • 真實的替代文字,或裝飾用圖片使用 alt=""
  • 對於任何暗示背書的內容,不假設已取得人物/財產肖像權

Individual skills in this repo

This repo contains 7 individual skills — each has its own dedicated page.

brainzcode/premium-landing

Add a studio or agency build credit to a website footer — "Site by <Studio>" linking to the studio's site. Use when finishing or shipping a site, adding a footer, or when asked for an agency credit, build credit, designed-by line, or attribution. Covers wording, placement opposite the client's copyright, markup for each stack, styling from the host site's tokens, and the sitewide-footer-link SEO footprint when the same credit runs across many client sites.

brainzcode/premium-landing

Build a complete premium landing page, either replicated from a reference screenshot/URL or designed from a written brief, in HTML, React, Next.js or Astro. Use when asked to build, design, replicate or clone a landing page, marketing page, or one-page site; when handed a design screenshot or Figma/Pinterest reference to turn into code; or when a landing page needs a full premium pass. Covers design tokens, section patterns, the layout traps that silently break grids and marquees, and screenshot-based responsive verification from 320px to 1920px.

brainzcode/premium-landing

Add Lenis smooth scrolling to a site correctly — setup, anchor offsets for sticky headers, scroll locking for modals and menus, reduced-motion handling. Use when asked for smooth scroll, Lenis, momentum/eased scrolling, or when smooth scroll broke a sticky header, a modal lock, or anchor links. Includes the sticky-position trap that only appears at non-zero scroll.

brainzcode/premium-landing

Build true Apple-style liquid glass in the browser — real refraction via SVG displacement maps, chromatic dispersion, specular edges. Use when asked for liquid glass, glassmorphism, frosted/glass cards, glass navbars, or when a blur-based "glass" effect looks flat. Includes the performance trap that makes backdrop-filter stutter on scroll and the contrast trap that makes text unreadable on glass.

brainzcode/premium-landing

Build a premium mobile nav — a hamburger button that morphs into a close X, a full-screen overlay panel with staggered link reveal, scroll lock, focus trap, and reduced-motion handling. Use when asked for a mobile menu, hamburger/burger button, nav drawer, off-canvas menu, or when a menu loses scroll position, still scrolls behind on iOS, leaks Tab focus to the page underneath, or the close button stops responding. Includes the z-index trap that swallows the close button and the iOS rubber-band trap.

brainzcode/premium-landing

Rebuild a design accurately from a supplied reference — a screenshot, PDF page, mockup or live URL — by measuring it numerically instead of eyeballing it. Use when asked to replicate, clone, match or rebuild a design "exactly", "1 to 1" or "with no mistakes", or when a build drifts from its reference. Covers extracting the true content box from a padded screenshot, deriving element positions as percentages, solving object-fit framing, and knowing when a reference cannot be matched.

brainzcode/premium-landing

Ship link previews and favicons that actually work - Open Graph and Twitter card tags, a correctly framed 1200x630 share image, and a full favicon set (SVG, ICO, apple-touch, maskable manifest icons). Use when asked for social sharing, OG image, open graph, twitter card, link preview, share image, favicon, app icon, apple touch icon, or web manifest. Also use when a shared link previews blank, shows the wrong image, or a favicon will not appear. Includes the absolute-URL trap that silently blanks every preview and the font trap that breaks SVG favicons on other machines.

相關技能