Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#845 [ShowMediasLinked] add: button to visualize picture #1070

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion css/saturne.min.css

Large diffs are not rendered by default.

27 changes: 27 additions & 0 deletions css/scss/modules/medias/_photo.scss
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,30 @@
margin-bottom: 1em;
}
}

.clickable-photo-preview {
position: absolute;
top: 3%;
right: 3%;
z-index: 900;
width: 20px;
height: 20px;
background: #fff;
border-radius: 50%;
transition: all 0.2s ease-out;
display: flex;
justify-content: center;
align-items: center;
text-decoration: none;

&:hover {
transform: scale(1.1);
text-decoration: none;
}

i {
line-height: 25px;
font-size: 14px;
color: $color__primary;
}
}
19 changes: 15 additions & 4 deletions lib/medias.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,23 +236,33 @@ function saturne_show_medias_linked(string $modulepart = 'ecm', string $sdir, $s
$alt = $langs->transnoentitiesnoconv('File') . ': ' . $relativefile;
$alt .= ' - ' . $langs->transnoentitiesnoconv('Size') . ': ' . $imgarray['width'] . 'x' . $imgarray['height'];
if ($notitle) $alt = '';
$return .= '<div>';
if ($usesharelink) {
if (empty($maxHeight) || $photo_vignette && $imgarray['height'] > $maxHeight) {
$return .= '<!-- Show thumb file -->';
if ($maxWidth > 50 && $maxHeight > 50)
$return .= '<a class="clickable-photo-preview" href="javascript:document_preview(\'' . DOL_URL_ROOT . '/custom/saturne/utils/viewimage.php?modulepart=' . $modulepart . '&entity=' . $object->entity . '&file=' . urlencode($pdirthumb . $photo_vignette) . '\', \'image/gif\', \'Aperçu ' . dol_escape_htmltag($alt) . ' \')"><i class="fas fa-2x fa-search-plus"></i></a>';
$return .= '<img width="' . $maxWidth . '" height="' . $maxHeight . '" class="photo '. $morecss .' photowithmargin" height="' . $maxHeight . '" src="' . DOL_URL_ROOT . '/custom/saturne/utils/viewimage.php?modulepart=' . $modulepart . '&entity=' . $object->entity . '&file=' . urlencode($pdirthumb . $photo_vignette) . '" title="' . dol_escape_htmltag($alt) . '" data-object-id="' . $object->id . '">';
} else {
$return .= '<!-- Show original file -->';
if ($maxWidth > 50 && $maxHeight > 50)
$return .= '<a class="clickable-photo-preview" href="javascript:document_preview(\'' . DOL_URL_ROOT . '/custom/saturne/utils/viewimage.php?modulepart=' . $modulepart . '&entity=' . $object->entity . '&file=' . urlencode($pdir . $photo) . '\', \'image/gif\', \'Aperçu ' . dol_escape_htmltag($alt) . ' \')"><i class="fas fa-2x fa-search-plus"></i></a>';
$return .= '<img width="' . $maxWidth . '" height="' . $maxHeight . '" class="photo '. $morecss .' photowithmargin" src="' . DOL_URL_ROOT . '/custom/saturne/utils/viewimage.php?modulepart=' . $modulepart . '&entity=' . $object->entity . '&file=' . urlencode($pdir . $photo) . '" title="' . dol_escape_htmltag($alt) . '" data-object-id="' . $object->id . '">';
}
} else {
if (empty($maxHeight) || $photo_vignette && $imgarray['height'] > $maxHeight) {
$return .= '<!-- Show thumb file -->';
if ($maxWidth > 50 && $maxHeight > 50)
$return .= '<a class="clickable-photo-preview" href="javascript:document_preview(\'' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $conf->entity . '&file=' . urlencode($pdirthumb . $photo_vignette) . '\', \'image/gif\', \'Aperçu ' . dol_escape_htmltag($alt) . ' \')"><i class="fas fa-2x fa-search-plus"></i></a>';
$return .= '<img width="' . $maxWidth . '" height="' . $maxHeight . '" class="photo '. $morecss .'" src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $conf->entity . '&file=' . urlencode($pdirthumb . $photo_vignette) . '" title="' . dol_escape_htmltag($alt) . '" data-object-id="' . $object->id . '">';
} else {
} else {
$return .= '<!-- Show original file -->';
$return .= '<img width="' . $maxWidth . '" height="' . $maxHeight . '" class="photo '. $morecss .' photowithmargin" height="' . $maxHeight . '" src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $conf->entity . '&file=' . urlencode($pdir . $photo) . '" title="' . dol_escape_htmltag($alt) . '" data-object-id="' . $object->id . '">';
}
if ($maxWidth > 50 && $maxHeight > 50)
$return .= '<a class="clickable-photo-preview" href="javascript:document_preview(\'' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $conf->entity . '&file=' . urlencode($pdir . $photo) . '\', \'image/gif\', \'Aperçu ' . dol_escape_htmltag($alt) . ' \')"><i class="fas fa-2x fa-search-plus"></i></a>';
$return .= '<img width="' . $maxWidth . '" height="' . $maxHeight . '" class="photo '. $morecss .' photowithmargin" height="' . $maxHeight . '" src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $conf->entity . '&file=' . urlencode($pdir . $photo) . '" title="' . dol_escape_htmltag($alt) . '" data-object-id="' . $object->id . '">';
}
}
$return .= '</div>';

if (empty($nolink)) $return .= '</a>';
$return .= "\n";
Expand Down Expand Up @@ -288,7 +298,8 @@ function saturne_show_medias_linked(string $modulepart = 'ecm', string $sdir, $s
}
$widthName = $moduleNameUpperCase . '_MEDIA_MAX_WIDTH_' . strtoupper($size);
$heightName = $moduleNameUpperCase . '_MEDIA_MAX_HEIGHT_' . strtoupper($size);
$return .= '<img width="' . $conf->global->$widthName . '" height="' . $conf->global->$heightName . '" class="photo photowithmargin" src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $conf->entity . '&file=' . urlencode($pdir . $photo) . '" data-object-id="' . $object->id . '">';
$return .= '<div><a class="clickable-photo-preview" href="javascript:document_preview(\'' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $conf->entity . '&file=' . urlencode($pdir . $photo) . '\', \'image/gif\', \'Aperçu ' . dol_escape_htmltag($alt) . ' \')"><i class="fas fa-2x fa-search-plus"></i></a></div>';
$return .= '<img width="' . $conf->global->$widthName . '" height="' . $conf->global->$heightName . '" class="photo photowithmargin" src="' . DOL_URL_ROOT . '/viewimage.php?modulepart=' . $modulepart . '&entity=' . $conf->entity . '&file=' . urlencode($pdir . $photo) . '" data-object-id="' . $object->id . '">';
if ($showfilename) {
$return .= '<br>' . $viewfilename;
}
Expand Down