Crop til 100/100
Hvis et billede er lige så høj som bredt virker scriptet ikke efter hensigten, det skal lace en crop af billeder til 100px høj og 100px bred.Set Jpeg = Server.CreateObject("Persits.Jpeg")
Jpeg.Open Server.Mappath("../hotstuff\tn\" & Name)
L = 200
If jpeg.OriginalWidth > jpeg.OriginalHeight Then
jpeg.Width = L
jpeg.Height = jpeg.OriginalHeight * L / jpeg.OriginalWidth
Else
jpeg.Height = L
jpeg.Width = jpeg.OriginalWidth * L / jpeg.OriginalHeight
End If
Jpeg.Save Server.Mappath("../hotstuff\tn\" & Name)
'CROPPER TING
Set Jpeg = Server.CreateObject("Persits.Jpeg")
Jpeg.Open Server.Mappath("../hotstuff\tn\" & Name)
Width = jpeg.OriginalWidth
Height = jpeg.OriginalHeight
NWidth = 100
NHeight = 100
if Width>Height then
if (Height/Width)*100>99 then
Height = NHeight
Width = NWidth
else
Height = NHeight
Width = Height * Width / Height
chopoff=(Width-NWidth)/2
jpeg.Crop chopoff,0 , Width-chopoff, 100
end if
else
if (Width/Height)*100>99 then
Height = NHeight
Width = NWidth
else
Width = NWidth
Height = Height * Width / Width
chopoff=(Height-100)/2
jpeg.Crop 0, chopoff, NWidth, Height-chopoff
end if
end if