Revert og:image header extraction — header is manual upload

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
John Mizerek 2026-03-15 09:46:21 -07:00
parent d7cd6774c7
commit 4c5d8b07dc

View file

@ -292,31 +292,6 @@ JSEOF;
} }
$siteName = $bizInfo['name'] ?? ''; $siteName = $bizInfo['name'] ?? '';
// 3. Extract header image from og:image or JSON-LD image
$headerImageUrl = '';
// Try og:image meta tag first (most common for restaurants)
if (preg_match('#<meta\s+(?:property|name)=["\']og:image["\']\s+content=["\']([^"\']+)["\']#i', $html, $ogm)) {
$headerImageUrl = trim($ogm[1]);
} elseif (preg_match('#<meta\s+content=["\']([^"\']+)["\']\s+(?:property|name)=["\']og:image["\']#i', $html, $ogm)) {
$headerImageUrl = trim($ogm[1]);
}
// Fallback: JSON-LD image field
if (empty($headerImageUrl) && preg_match_all('#<script[^>]*type=["\']application/ld\+json["\'][^>]*>([^<]+)</script>#i', $html, $ldImgMatches)) {
foreach ($ldImgMatches[1] as $ldJson) {
$ld = json_decode($ldJson, true);
if (!is_array($ld)) continue;
$entries = isset($ld['@graph']) ? $ld['@graph'] : [$ld];
foreach ($entries as $entry) {
if (!empty($entry['image'])) {
$img = $entry['image'];
if (is_string($img)) { $headerImageUrl = $img; break 2; }
if (is_array($img) && !empty($img['url'])) { $headerImageUrl = $img['url']; break 2; }
if (is_array($img) && isset($img[0])) { $headerImageUrl = is_string($img[0]) ? $img[0] : ($img[0]['url'] ?? ''); break 2; }
}
}
}
}
// Parse address into components if only full string // Parse address into components if only full string
if (!empty($bizInfo['address']) && empty($bizInfo['addressLine1'])) { if (!empty($bizInfo['address']) && empty($bizInfo['addressLine1'])) {
$addr = $bizInfo['address']; $addr = $bizInfo['address'];
@ -468,7 +443,6 @@ JSEOF;
'platformPages' => $platformPages, 'platformPages' => $platformPages,
'hasPlatform' => $hasPlatform, 'hasPlatform' => $hasPlatform,
'totalPagesFound' => count($menuPages), 'totalPagesFound' => count($menuPages),
'headerImageUrl' => $headerImageUrl,
]); ]);
} }