Skip to content

Commit

Permalink
! Fix elkarte#3677, do not reszie the preview when not asked
Browse files Browse the repository at this point in the history
  • Loading branch information
Spuds committed Apr 2, 2024
1 parent ae61aaa commit 5aacf73
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions sources/ElkArte/Controller/Attachment.php
Expand Up @@ -789,14 +789,15 @@ public function action_tmpattach()

$this->prepare_headers($filename, $eTag, $mime_type, 'inline', $real_filename, $do_cache);

if ($resize)
// do not resize for ;image
if ($resize && !isset($this->_req->query->ila, $this->_req->query->image))
{
// Create a thumbnail image
$image = new Image($filename);

$filename .= '_thumb';
$max_width = $this->_req->isSet('thumb') && !empty($modSettings['attachmentThumbWidth']) ? $modSettings['attachmentThumbWidth'] : 250;
$max_height = $this->_req->isSet('thumb') && !empty($modSettings['attachmentThumbHeight']) ? $modSettings['attachmentThumbHeight'] : 250;
$max_width = $this->_req->isSet('thumb') && !empty($modSettings['attachmentThumbWidth']) ? $modSettings['attachmentThumbWidth'] : 300;
$max_height = $this->_req->isSet('thumb') && !empty($modSettings['attachmentThumbHeight']) ? $modSettings['attachmentThumbHeight'] : 300;

$image->createThumbnail($max_width, $max_height, $filename, null, false);
}
Expand Down
4 changes: 2 additions & 2 deletions sources/ElkArte/IlaIntegrate.php
Expand Up @@ -302,7 +302,7 @@ public static function buildTag()
$alt = Util::htmlspecialchars($attachment['filename'] ?? 'X');
self::$typeTag = '
<a id="link_$1" data-lightboximage="$1" data-lightboxmessage="0" href="' . getUrl('action', ['action' => 'dlattach', 'attach' => '$1', 'image']) . '">
<img src="' . getUrl('action', ['action' => 'dlattach', 'attach' => '$1']) . $type . '" style="' . $style . '" alt="' . $alt . '" class="bbc_img ' . $class . '" loading="lazy" />
<img src="' . getUrl('action', ['action' => 'dlattach', 'attach' => '$1', 'ila' => '1']) . $type . '" style="' . $style . '" alt="' . $alt . '" class="bbc_img ' . $class . '" loading="lazy" />
</a>';
}
// Not an image, determine a mime thumbnail or use a default thumbnail
Expand All @@ -328,7 +328,7 @@ public static function buildTag()
}

/**
* This is prevents a little repetition and provides a some control for url tags
* This prevents a little repetition and provides a some control for url tags
*
* - Determines if the ILA is an image or not
* - Keeps track of attachment usage to prevent displaying below the post
Expand Down

0 comments on commit 5aacf73

Please sign in to comment.