Skip to content

Commit 3ccf5b8

Browse files
authored
Merge pull request #90 from BigKev73/patch-9
Update functions.image.php
2 parents 7bcd0d3 + 7171827 commit 3ccf5b8

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

include/functions.image.php

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,10 @@ function newbbAttachmentImage($source)
5050
$img_info = '';
5151

5252
$imginfo = @getimagesize($image);
53-
if (is_array($image)) {
53+
// Change by BigKev73 - Removed the is_array check, otherwise the img_info is never set
54+
//if (is_array($image)) {
5455
$img_info = (count($imginfo) > 0) ? $imginfo[0] . 'X' . $imginfo[1] . ' px' : '';
55-
}
56+
//}
5657

5758
if ($GLOBALS['xoopsModuleConfig']['max_image_width'] > 0
5859
&& $GLOBALS['xoopsModuleConfig']['max_image_height'] > 0) {
@@ -63,7 +64,10 @@ function newbbAttachmentImage($source)
6364
newbbCreateThumbnail($source, $GLOBALS['xoopsModuleConfig']['max_image_width']);
6465
}
6566
}
66-
67+
}
68+
69+
// Change by BigKev73 - moved this outside the above logic, or this never get sets if thumbnails dont get created
70+
6771
if ($imginfo[0] > $GLOBALS['xoopsModuleConfig']['max_image_width']
6872
|| $imginfo[1] > $GLOBALS['xoopsModuleConfig']['max_image_height']) {
6973
$pseudo_width = $GLOBALS['xoopsModuleConfig']['max_image_width'];
@@ -77,12 +81,13 @@ function newbbAttachmentImage($source)
7781
$pseudo_width = $GLOBALS['xoopsModuleConfig']['max_image_height'] * ($imginfo[0] / $imginfo[1]);
7882
$pseudo_size = "width='" . $pseudo_width . "px' height='" . $pseudo_height . "px'";
7983
}
80-
}
84+
8185

8286
if (file_exists($thumb)) {
8387
$attachmentImage = '<a href="' . $image_url . '" title="' . $source . ' ' . $img_info . '" target="_blank">';
84-
// $attachmentImage .= '<img src="' . $thumb_url . '" alt="' . $source . ' ' . $img_info . '" >';
85-
$attachmentImage .= '<img src="' . $image_url . '" ' . $pseudo_size . ' alt="' . $source . ' ' . $img_info . '" >';
88+
// Change by BigKev73 - Changed this code back or thumbnails never get displayed, even if they got created ok
89+
$attachmentImage .= '<img src="' . $thumb_url . '" alt="' . $source . ' ' . $img_info . '" >';
90+
// $attachmentImage .= '<img src="' . $image_url . '" ' . $pseudo_size . ' alt="' . $source . ' ' . $img_info . '" >';
8691
$attachmentImage .= '</a>';
8792
} elseif (!empty($pseudo_size)) {
8893
$attachmentImage = '<a href="' . $image_url . '" title="' . $source . ' ' . $img_info . '" target="_blank">';

0 commit comments

Comments
 (0)