SZDB#82496 Foto's onscherp in overzicht voorzieningen

svn path=/Website/trunk/; revision=64544
This commit is contained in:
Erik Groener
2024-05-06 12:07:30 +00:00
parent a66102aa9a
commit ebe40cf9de
2 changed files with 47 additions and 40 deletions

View File

@@ -1197,8 +1197,8 @@ function resizePicture(pic)
{
switch (pic.module)
{
case "RESPHD": maxThumbW = 192; maxThumbH = 108; break;
case "INSPHD": maxThumbW = 192; maxThumbH = 108; break;
case "RESPHD": maxThumbW = 192; maxThumbH = 144; break;
case "INSPHD": maxThumbW = 192; maxThumbH = 144; break;
case "SML": maxThumbW = 80; maxThumbH = 60; break;
default: maxThumbW = 100; maxThumbH = 100;
}

View File

@@ -30,54 +30,61 @@ function upgrade20242()
oRs.Close();
/* START INS_DEEL_IMAGE THUMBNAIL CONVERSIE */
var fso = Server.CreateObject("Scripting.FileSystemObject");
var ins_deel_image_path = S("ins_image_path") + "\deel";
var oldPhotoPath = Server.MapPath(ins_deel_image_path);
var ins_PhotoPath = Server.MapPath(S("ins_image_path") + "\deel");
convertThumb(ins_PhotoPath);
var res_PhotoPath = Server.MapPath(S("res_image_path") + "\deel");
convertThumb(res_PhotoPath);
if (fso.FolderExists(oldPhotoPath))
function convertThumb(oldPhotoPath)
{
if (!fso.FolderExists(oldPhotoPath + "/thumb/"))
__Log("Converting " + oldPhotoPath);
var fso = Server.CreateObject("Scripting.FileSystemObject");
if (fso.FolderExists(oldPhotoPath))
{
fso.CreateFolder(oldPhotoPath + "/thumb/");
}
var oIMG = Server.CreateObject("SLNKDWF.ImageConvert");
var maxThumbW = 108;
var maxThumbH = 192;
var insPhotoFolder = fso.GetFolder(oldPhotoPath);
var f_org = new Enumerator(insPhotoFolder.files);
for (; !f_org.atEnd(); f_org.moveNext())
{
try
if (!fso.FolderExists(oldPhotoPath + "/thumb/"))
{
var photo = f_org.item();
var orgPhotoName = photo.Name;
var thumbPhotoPath = oldPhotoPath + "/thumb/"+ orgPhotoName;
if (fso.fileExists(thumbPhotoPath))
{ // Bestaande thumbnail verwijderen.
f_thumb = fso.getFile(thumbPhotoPath);
f_thumb.Delete();
}
// Nieuw formaat thumbnail weer toevoegen.
oIMG.Open(oldPhotoPath + "/" + orgPhotoName);
if (oIMG.Width / oIMG.Height > maxThumbW / maxThumbH)
{
oIMG.Height = oIMG.Height / oIMG.Width * maxThumbW;
oIMG.Width = maxThumbW;
}
else
{
oIMG.Width = oIMG.Width / oIMG.Height * maxThumbH;
oIMG.Height = maxThumbH;
}
oIMG.SaveAs(thumbPhotoPath);
fso.CreateFolder(oldPhotoPath + "/thumb/");
}
catch (e)
var oIMG = Server.CreateObject("SLNKDWF.ImageConvert");
var maxThumbW = 192;
var maxThumbH = 144;
var insPhotoFolder = fso.GetFolder(oldPhotoPath);
var f_org = new Enumerator(insPhotoFolder.files);
for (; !f_org.atEnd(); f_org.moveNext())
{
__DoLog("ERROR resizing thumbnails" + oldPhotoPath + "/" + orgPhotoName + " -> " + thumbPhotoPath + "/" + orgPhotoNamePhotoName, "#FF0000");
__DoLog(e.description);
try
{
var photo = f_org.item();
var orgPhotoName = photo.Name;
var thumbPhotoPath = oldPhotoPath + "/thumb/"+ orgPhotoName;
if (fso.fileExists(thumbPhotoPath))
{ // Bestaande thumbnail verwijderen.
f_thumb = fso.getFile(thumbPhotoPath);
f_thumb.Delete();
}
// Nieuw formaat thumbnail weer toevoegen.
oIMG.Open(oldPhotoPath + "/" + orgPhotoName);
if (oIMG.Width / oIMG.Height > maxThumbW / maxThumbH)
{
oIMG.Height = oIMG.Height / oIMG.Width * maxThumbW;
oIMG.Width = maxThumbW;
}
else
{
oIMG.Width = oIMG.Width / oIMG.Height * maxThumbH;
oIMG.Height = maxThumbH;
}
oIMG.SaveAs(thumbPhotoPath);
}
catch (e)
{
__DoLog("ERROR resizing thumbnails" + oldPhotoPath + "/" + orgPhotoName + " -> " + thumbPhotoPath + "/" + orgPhotoName, "#FF0000");
__DoLog(e.description);
}
}
}
}
/* EINDE INS_DEEL_IMAGE THUMBNAIL CONVERSIE */
// Track dat we ge-upgrade hebben, geen risico voor multi-user omgevingen