mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Prepare code for image edit
This commit is contained in:
parent
e5566609ea
commit
57d832052e
|
|
@ -538,7 +538,7 @@ if (!empty($mysoc->logo_small)) {
|
|||
print '</div>';
|
||||
if (file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) {
|
||||
print '<div class="inline-block valignmiddle">';
|
||||
print '<img style="max-height: 80px; max-width: 200px;" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_small).'">';
|
||||
print '<img id="logo" style="max-height: 80px; max-width: 200px;" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_small).'">';
|
||||
print '</div>';
|
||||
} elseif (!empty($mysoc->logo)) {
|
||||
if (!file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) {
|
||||
|
|
@ -546,18 +546,18 @@ if (!empty($mysoc->logo_small)) {
|
|||
}
|
||||
$imgThumbSmall = vignette($conf->mycompany->dir_output.'/logos/'.$mysoc->logo, $maxwidthmini, $maxheightmini, '_small', $quality);
|
||||
print '<div class="inline-block valignmiddle">';
|
||||
print '<img style="max-height: 80px; max-width: 200px;" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('logos/thumbs/'.basename($imgThumbSmall)).'">';
|
||||
print '<img id="logo" style="max-height: 80px; max-width: 200px;" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('logos/thumbs/'.basename($imgThumbSmall)).'">';
|
||||
print '</div>';
|
||||
}
|
||||
} elseif (!empty($mysoc->logo)) {
|
||||
if (file_exists($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) {
|
||||
print '<div class="inline-block valignmiddle">';
|
||||
print '<img style="max-height: 80px" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('logos/'.$mysoc->logo).'">';
|
||||
print '<img id="logo" style="max-height: 80px" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('logos/'.$mysoc->logo).'">';
|
||||
print '</div>';
|
||||
print '<div class="inline-block valignmiddle marginrightonly"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogo&token='.newToken().'">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a></div>';
|
||||
} else {
|
||||
print '<div class="inline-block valignmiddle">';
|
||||
print '<img height="80" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png" title="File has been removed from disk">';
|
||||
print '<img id="logo" height="80" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png" title="File has been removed from disk">';
|
||||
print '</div>';
|
||||
}
|
||||
}
|
||||
|
|
@ -580,7 +580,7 @@ if (!empty($mysoc->logo_squarred_small)) {
|
|||
print '</div>';
|
||||
if (file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_squarred_small)) {
|
||||
print '<div class="inline-block valignmiddle marginrightonly">';
|
||||
print '<img style="max-height: 80px" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_squarred_small).'">';
|
||||
print '<img id="logosquarred" style="height: 80px; width: 80px;" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_squarred_small).'">';
|
||||
print '</div>';
|
||||
} elseif (!empty($mysoc->logo_squarred)) {
|
||||
if (!file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_squarred_mini)) {
|
||||
|
|
@ -588,19 +588,22 @@ if (!empty($mysoc->logo_squarred_small)) {
|
|||
}
|
||||
$imgThumbSmall = vignette($conf->mycompany->dir_output.'/logos/'.$mysoc->logo_squarred, $maxwidthmini, $maxheightmini, '_small', $quality);
|
||||
print '<div class="inline-block valignmiddle">';
|
||||
print '<img style="max-height: 80px" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('logos/thumbs/'.basename($imgThumbSmall)).'">';
|
||||
print '<img id="logosquarred" style="height: 80px; width: 80px;" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('logos/thumbs/'.basename($imgThumbSmall)).'">';
|
||||
print '</div>';
|
||||
}
|
||||
print imgAddEditDeleteButton("logosquarred", '', $_SERVER["PHP_SELF"].'?action=removelogosquarred&token='.newToken());
|
||||
} elseif (!empty($mysoc->logo_squarred)) {
|
||||
if (file_exists($conf->mycompany->dir_output.'/logos/'.$mysoc->logo_squarred)) {
|
||||
print '<div class="inline-block valignmiddle">';
|
||||
print '<img style="max-height: 80px" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('logos/'.$mysoc->logo_squarred).'">';
|
||||
print '<img id="logosquarred" style="height: 80px; width: 80px;" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&file='.urlencode('logos/'.$mysoc->logo_squarred).'">';
|
||||
print '</div>';
|
||||
print '<div class="inline-block valignmiddle marginrightonly"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=removelogosquarred&token='.newToken().'">'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'</a></div>';
|
||||
print imgAddEditDeleteButton("logosquarred", '', $_SERVER["PHP_SELF"].'?action=removelogosquarred&token='.newToken());
|
||||
} else {
|
||||
print '<div class="inline-block valignmiddle">';
|
||||
print '<img height="80" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png" title="File has been removed from disk">';
|
||||
print '<img id="logosquarred" style="height: 80px; width: 80px;" src="'.DOL_URL_ROOT.'/public/theme/common/nophoto.png" title="File has been removed from disk">';
|
||||
print '</div>';
|
||||
print imgAddEditDeleteButton("logosquarred", '', '');
|
||||
}
|
||||
}
|
||||
print '</div>';
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
<?php
|
||||
use RectorPrefix202310\Nette\Utils\Image;
|
||||
|
||||
/* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2007 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
|
|
@ -515,7 +517,7 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small',
|
|||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
|
||||
global $conf, $langs;
|
||||
global $langs;
|
||||
|
||||
dol_syslog("vignette file=".$file." extName=".$extName." maxWidth=".$maxWidth." maxHeight=".$maxHeight." quality=".$quality." outdir=".$outdir." targetformat=".$targetformat);
|
||||
|
||||
|
|
@ -814,3 +816,18 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small',
|
|||
|
||||
return $imgThumbName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Beautify an image by adding a link edit and delete on image
|
||||
*
|
||||
* @param string $htmlid ID of HTML img tag
|
||||
* @param string $urledit URL to submit to edit Image
|
||||
* @param string $urldelete URL to call when deleting the image
|
||||
* @return string HTML and JS code to manage the update/delete of image.
|
||||
*/
|
||||
function imgAddEditDeleteButton($htmlid, $urledit, $urldelete)
|
||||
{
|
||||
// TODO
|
||||
return '';
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user