Skip to content

Commit

Permalink
Fix the thumb logic
Browse files Browse the repository at this point in the history
  • Loading branch information
dgrammatiko committed Nov 9, 2021
1 parent 2bda307 commit 1ed0770
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ public function thumb($template, $clientId = 0)
$html = '<button type="button" data-bs-target="#' . $template->name . '-Modal" class="thumbnail" data-bs-toggle="modal" title="' . Text::_('COM_TEMPLATES_CLICK_TO_ENLARGE') . '">' . $html . '</button>';
}
} else {
$html = HTMLHelper::_('image', 'media/system/images/template_thumb.svg', Text::_('COM_TEMPLATES_PREVIEW'));
$html = HTMLHelper::_('image', 'media/system/images/template_thumb.svg', Text::_('COM_TEMPLATES_PREVIEW'), ['style' => 'width:200px; height:120px;']);
}
} elseif (file_exists(JPATH_ROOT . $client->path . '/templates/' . $template->name . '/template_thumbnail.png')) {
$html = HTMLHelper::_('image', (($template->client_id == 0) ? Uri::root(true) : Uri::root(true) . '/administrator') . '/templates/' . $template->name . '/template_thumbnail.png', Text::_('COM_TEMPLATES_PREVIEW'));
} elseif (file_exists($client->path . '/templates/' . $template->name . '/template_thumbnail.png')) {
$html = HTMLHelper::_('image', (($template->client_id == 0) ? Uri::root(true) : Uri::root(true) . 'administrator/') . 'templates/' . $template->name . '/template_thumbnail.png', Text::_('COM_TEMPLATES_PREVIEW'));

if (file_exists(JPATH_ROOT . $client->path . '/templates/' . $template->name . '/images/template_preview.png')) {
if (file_exists($client->path . '/templates/' . $template->name . '/template_preview.png')) {
$html = '<button type="button" data-bs-target="#' . $template->name . '-Modal" class="thumbnail" data-bs-toggle="modal" title="' . Text::_('COM_TEMPLATES_CLICK_TO_ENLARGE') . '">' . $html . '</button>';
}
} else {
Expand Down Expand Up @@ -120,11 +120,11 @@ public function thumbModal($template, $clientId = 0)
$preview = 'media/templates/' . $client->name . '/' . $template->name . '/images/template_preview.png';
}
}
} elseif (file_exists(JPATH_ROOT . $client->path . '/templates/' . $template->name . '/template_thumbnail.png')) {
$thumb = 'templates/' . $template->name . '/template_thumbnail.png';
} elseif (file_exists($client->path . '/templates/' . $template->name . '/template_thumbnail.png')) {
$thumb = (($template->client_id == 0) ? Uri::root(true) : Uri::root(true) . 'administrator') . '/templates/' . $template->name . '/template_thumbnail.png';

if (file_exists(JPATH_ROOT . $client->path . '/templates/' . $template->name . '/images/template_preview.png')) {
$preview = $client->path . '/templates/' . $template->name . '/images/template_preview.png';
if (file_exists($client->path . '/templates/' . $template->name . '/template_preview.png')) {
$preview = (($template->client_id == 0) ? Uri::root(true) : Uri::root(true) . 'administrator') . '/templates/' . $template->name . '/template_preview.png';
}
}

Expand All @@ -141,7 +141,7 @@ public function thumbModal($template, $clientId = 0)
'width' => '800px',
'footer' => $footer,
),
'<div><img src="' . Uri::root() . $preview . '" style="max-width:100%" alt="' . $template->name . '"></div>'
'<div><img src="' . $preview . '" style="max-width:100%" alt="' . $template->name . '"></div>'
);
}

Expand Down

0 comments on commit 1ed0770

Please sign in to comment.