From 1687cced062f72f484e873d29eb908090f576434 Mon Sep 17 00:00:00 2001
From: B Vikas Chandra <48272577+vikaschandrab@users.noreply.github.com>
Date: Tue, 30 Sep 2025 21:01:13 +0530
Subject: [PATCH] issue fixes
---
resources/views/public/blogs/show.blade.php | 93 ++++++++++++++++-----
1 file changed, 72 insertions(+), 21 deletions(-)
diff --git a/resources/views/public/blogs/show.blade.php b/resources/views/public/blogs/show.blade.php
index 74fcbfe..2137537 100644
--- a/resources/views/public/blogs/show.blade.php
+++ b/resources/views/public/blogs/show.blade.php
@@ -31,30 +31,80 @@
@php
- // Get the absolute URL for images
+ // Debug information
+ Log::info('Blog Share Debug Info', [
+ 'blog_id' => $blog->id,
+ 'blog_title' => $blog->title,
+ 'author_id' => $blog->user->id,
+ 'author_name' => $blog->user->name,
+ 'featured_image' => $blog->featured_image,
+ 'author_photo' => $blog->user->profile_photo_path,
+ 'url' => request()->url()
+ ]);
+
+ // Get the absolute URL for images with strict checking
$imageUrl = '';
- if ($blog->featured_image && Storage::disk('public')->exists($blog->featured_image)) {
+ $defaultLogo = url('/public/meetmytech_logo.jpg');
+
+ // Function to verify image existence and accessibility
+ function verifyImage($path) {
+ if (empty($path)) return false;
+
+ // For absolute URLs
+ if (filter_var($path, FILTER_VALIDATE_URL)) {
+ $headers = @get_headers($path);
+ return $headers && strpos($headers[0], '200') !== false;
+ }
+
+ // For storage files
+ return Storage::disk('public')->exists($path);
+ }
+
+ // Check featured image
+ if ($blog->featured_image && verifyImage($blog->featured_image)) {
$imageUrl = url(Storage::url($blog->featured_image));
- } elseif ($blog->user->profile_photo_path && Storage::disk('public')->exists($blog->user->profile_photo_path)) {
+ Log::info('Using featured image: ' . $imageUrl);
+ }
+ // Check author's profile photo
+ elseif ($blog->user->profile_photo_path && verifyImage($blog->user->profile_photo_path)) {
$imageUrl = url(Storage::url($blog->user->profile_photo_path));
- } else {
- $imageUrl = url('meetmytech_logo.jpg');
+ Log::info('Using author photo: ' . $imageUrl);
+ }
+ // Use default logo
+ else {
+ $imageUrl = $defaultLogo;
+ Log::info('Using default logo: ' . $imageUrl);
}
- // Ensure the image exists and is accessible
- $imageHeaders = get_headers($imageUrl);
- if (!$imageHeaders || strpos($imageHeaders[0], '200') === false) {
- $imageUrl = url('meetmytech_logo.jpg');
+ // Final verification
+ if (!verifyImage($imageUrl)) {
+ $imageUrl = $defaultLogo;
+ Log::info('Fallback to default logo after verification failed');
+ }
+
+ // Force HTTPS for production
+ if (app()->environment('production') && !str_starts_with($imageUrl, 'https://')) {
+ $imageUrl = str_replace('http://', 'https://', $imageUrl);
}
@endphp
-
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
+
+
@@ -63,11 +113,14 @@
+
+
-
+
+
@@ -85,15 +138,13 @@
-
+
-
+
-
-
-
-
+
+
@@ -123,7 +174,7 @@
"description": "{{ $blog->description ?: ($blog->excerpt ?: Str::limit(strip_tags($blog->content), 155)) }}",
"image": {
"@type": "ImageObject",
- "url": "{{ $blog->featured_image ? asset('storage/' . $blog->featured_image) : asset('meetmytech_logo.jpg') }}",
+ "url": "{{ $imageUrl }}?v={{ time() }}",
"width": 1200,
"height": 630
},