From 638fc72ccda36aa3bae944e1b5e4a02232d0410f Mon Sep 17 00:00:00 2001
From: snow flurry <snow@datagirl.xyz>
Date: Thu, 24 Apr 2025 23:57:51 -0700
Subject: [PATCH] add patches/

We should be tracking those here instead of random F9 threads.
---
 patches/README.md                 |  2 ++
 patches/smf21_expand_attach.patch | 22 ++++++++++++++++++++++
 2 files changed, 24 insertions(+)
 create mode 100644 patches/README.md
 create mode 100644 patches/smf21_expand_attach.patch

diff --git a/patches/README.md b/patches/README.md
new file mode 100644
index 0000000..1a4b524
--- /dev/null
+++ b/patches/README.md
@@ -0,0 +1,2 @@
+Any patches I can't fit into a proper SMF package for one reason or another end
+up here.
diff --git a/patches/smf21_expand_attach.patch b/patches/smf21_expand_attach.patch
new file mode 100644
index 0000000..f34bdea
--- /dev/null
+++ b/patches/smf21_expand_attach.patch
@@ -0,0 +1,22 @@
+Modifies inline image attachment rendering to provide a link to the image itself.
+
+--- old/Sources/Subs.php	2025-02-28 07:33:43.973736879 +0000
++++ new/Sources/Subs.php	2025-03-23 06:17:03.956035213 +0000
+@@ -1769,14 +1769,16 @@
+ 						// Image.
+ 						if (!empty($currentAttachment['is_image']))
+ 						{
++							$returnContext .= '<a href="' . $currentAttachment['href'] . ';image" target="_blank">';
+ 							if (empty($params['{width}']) && empty($params['{height}']))
+-								$returnContext .= '<img src="' . $currentAttachment['href'] . '"' . $alt . $title . ' class="bbc_img">';
++								$returnContext .= '<img src="' . $currentAttachment['href'] . ';image"' . $alt . $title . ' class="bbc_img">';
+ 							else
+ 							{
+ 								$width = !empty($params['{width}']) ? ' width="' . $params['{width}'] . '"': '';
+ 								$height = !empty($params['{height}']) ? 'height="' . $params['{height}'] . '"' : '';
+ 								$returnContext .= '<img src="' . $currentAttachment['href'] . ';image"' . $alt . $title . $width . $height . ' class="bbc_img resized"/>';
+ 							}
++							$returnContext .= '</a>';
+ 						}
+ 						// Video.
+ 						elseif (strpos($currentAttachment['mime_type'], 'video/') === 0)