new image show system, allowing dynamic preview images

This commit is contained in:
Thomas Weinhold 2020-09-26 21:32:58 +02:00
commit dfda07ae1c
8 changed files with 193 additions and 53 deletions

View file

@ -110,7 +110,7 @@ function OtherGetIcon ($IconName,$CssClass)
$IconDirectory='./templates/'.$GlobalTemplate.'/icons/';
$Error = 0;
$RetVal = "";
if (file_exists($IconDirectory.$IconName.".png")) $IconFile=$IconName.".png";
elseif (file_exists($IconDirectory.$IconName.".jpg")) $IconFile=$IconName.".jpg";
elseif (file_exists($IconDirectory.$IconName.".gif")) $IconFile=$IconName.".gif";
@ -120,13 +120,35 @@ function OtherGetIcon ($IconName,$CssClass)
//log if template directory is existing - if not, anyone else will report this
if (file_exists("./templates/".$GlobalTemplate)) ErrorLog("Icon '$IconName' +[.png|.jpg|.gif] not found!");
}
if (!$Error)
{
$RetVal = "<img src=\"$IconDirectory$IconFile\"".(($CssClass)? " class=\"$CssClass\"":"").">";
}
return $RetVal;
}
?>
// Returns a html <img> tag
function OtherGetPictureImg($part_id, $max_width=0, $max_height=0) {
// create anchor tag
$tag = "<a href=\"part_picture.php?PartId=$part_id\">";
// create img tag
$tag .= "<img src=\"part_picture.php?PartId=$part_id";
if ($max_width > 0) $tag .= "&MaxWidth=$max_width";
if ($max_height > 0) $tag .= "&MaxHeight=$max_height";
$tag .= "\""; // finish src attribute
$tag .= " alt=\"picture of part $part_id\"";
$tag .= ">"; // finish img tag
// close link
$tag .= '</a>';
return $tag;
}
?>