return "<img src=\"{$writeUrl}\" style=\"width: 100%; visibility: {$visibility}\" class=\"dummyImage {$classes}\" title=\"{$title}\" alt=\"{$title}\" />";
return "<img src=\"{$writeUrl}\" style=\"visibility: {$visibility}\" class=\"dummyImage {$classes}\" title=\"{$title}\" alt=\"{$title}\" />";
if ($height < $max_height && $width < $max_width)
{
return true;
}
//Want to fit in the area?
if ($method == 'fit')
<xen:if is="{$album.mediaCache}">
<a href="{xen:link xengallery/albums, $album}">
<img src="{$album.mediaCache.placeholder}" class="thumbImage AlbumThumbs show" data-images="{xen:helper implode, $album.mediaCache.thumbnails, ','}" alt="{$album.album_title}" />
</a>
<xen:else />
<xen:if is="{$album.mediaCache}">
<a href="{xen:link xengallery/albums, $album}" class="thumbImageLink">
<img src="{$album.mediaCache.placeholder}" class="thumbImage AlbumThumbs show" data-images="{xen:helper implode, $album.mediaCache.thumbnails, ','}" alt="{$album.album_title}" />
</a>
<xen:else />
.albumContainer .thumbImage
{
width: 100%;
border-radius: 4px 4px 0 0;
}
.albumContainer .thumbImage
{
border-radius: 4px 4px 0 0;
vertical-align: middle;
}
.thumbnailContainer
{
overflow: hidden;
position: relative;
width: 100%;
}
.thumbnailContainer
{
overflow: hidden;
position: relative;
width: 100%;
text-align: center;
}
.thumbImageLink
{
line-height: {$xenOptions.xengalleryThumbnailDimension.height}px;
}
<xen:if is="{$item.media_type} == 'image_upload'">
<a href="{xen:link xengallery, $item}">
<img src="{$item.thumbnailUrl}?{$item.last_edit_date}" class="thumbImage" alt="{$item.media_title}" />
</a>
<xen:else />
<xen:if is="{$item.media_type} == 'image_upload'">
<a href="{xen:link xengallery, $item}" class="thumbImageLink">
<img src="{$item.thumbnailUrl}?{$item.last_edit_date}" class="thumbImage" alt="{$item.media_title}" />
</a>
<xen:else />
.mediaContainer .thumbImage
{
width: 100%;
vertical-align: middle;
border-radius: 3px 3px 0 0;
}
.mediaContainer .thumbImage
{
vertical-align: middle;
border-radius: 3px 3px 0 0;
}
.thumbnailContainer
{
overflow: hidden;
position: relative;
width: 100%;
}
.thumbnailContainer
{
overflow: hidden;
position: relative;
width: 100%;
text-align: center;
}
.thumbImageLink
{
line-height: {$xenOptions.xengalleryThumbnailDimension.height}px;
}
Just a quick note to say I have implemented this in XFMG 1.1.9 and all is ok. A few of the line numbers in the tutorial have changed but it's easy enough to find the contentHi,
This is feasible, though it's through file editing as your image helper class already as everything that's necessary
I did that for sross which is a long time customer of mine so I am posting it here in case it helps some others, and perhaps you could add that as an option in admincp @Chris D ?
Explanations here below are valid for XFMG 1.2.2.
File edits
I don't suppose you ended up also doing something similar for XF2 per chance?
// Customization Begin: Fit instead of crop
// to not cut off portrait or landscape photos
// change crop thumbnail to fit
// $image->resizeAndCrop($thumbWidth, $thumbHeight)
// ->unsharpMask();
$origWidth = $image->getWidth();
$origHeight = $image->getHeight();
if ($origWidth > $origHeight) {
// Landscape: scale down based on max width, calculate proportional height
$newWidth = $thumbWidth;
$newHeight = max(1, round(($origHeight / $origWidth) * $thumbWidth));
} else {
// Portrait or Square: scale down based on max height, calculate proportional width
$newHeight = $thumbHeight;
$newWidth = max(1, round(($origWidth / $origHeight) * $thumbHeight));
}
// Pass the strictly positive, proportional dimensions to the driver
$image->resizeTo($newWidth, $newHeight)
->unsharpMask();
// Customization End: Fit instead of crop
/* Center uncropped XFMG thumbnails cleanly */
.xfmgThumbnail {
display: flex !important;
align-items: center !important;
justify-content: center !important;
background-color: #ffffff; /* Fills empty padding space with white */
width: 100%;
height: 100%;
}
.xfmgThumbnail-image {
width: auto !important;
height: auto !important;
max-width: 100% !important;
max-height: 100% !important;
}
.xfmgThumbnail.xfmgThumbnail--fluid {
border-radius: 5px;
}
/* increase margin between gallery thumbnails from 3px default to 10px */
.itemList-item {
margin: 10px !important;
}
We use essential cookies to make this site work, and optional cookies to enhance your experience.