<% dim Path dim NewWidth, NewHeight, OriginalWidth, OriginalHeight, ResizeOptionWidth dim Update Path = trim(request("Path")) if Path = "" then response.write "Please select an image first":response.End() NewWidth = trim(request("NewWidth")) NewHeight = trim(request("NewHeight")) OriginalWidth = trim(request("OriginalWidth")) OriginalHeight = trim(request("OriginalHeight")) ResizeOptionWidth = trim(request("ResizeOptionWidth")) if NewWidth = "" or isNumeric(NewWidth) = false then NewWidth = 0 if NewHeight = "" or isNumeric(NewHeight) = false then NewHeight = 0 if OriginalWidth = "" or isNumeric(OriginalWidth) = false then OriginalWidth = 0 if OriginalHeight = "" or isNumeric(OriginalHeight) = false then OriginalHeight = 0 Update = trim(request("Update")) if Update <> "" then Update = true else Update = false end if ' Resize Image if Update then if NewWidth <= 0 or NewHeight <=0 or OriginalWidth <= 0 or OriginalHeight <= 0 then response.write "
Sizes must be bigger than 0
" else ' Resize if ReportFileStatus(EditorRootFolderPath & Path) then Dim Jpeg, FileName FileName = EditorRootFolderPath & Path Set Jpeg = Server.CreateObject("Persits.Jpeg") Jpeg.Quality = 90 Jpeg.Open FileName if lcase(ResizeOptionWidth) = "px" then Jpeg.Width = NewWidth Jpeg.Height = NewHeight elseif (ResizeOptionWidth) = "%" then Jpeg.Width = CInt(OriginalWidth*(1/(100/NewWidth))) Jpeg.Height = CInt(OriginalHeight*(1/(100/NewHeight))) NewWidth = Jpeg.Width NewHeight = Jpeg.Height end if Jpeg.Save FileName Set Jpeg = nothing ' Error Check if err.number <> 0 then response.write "
Could not resize image. Please try again
" err.clear else %> <% end if end if end if end if %>
" method="post" name="Resize" class="text" id="Resize">
Image:
<%=Path%>
Original Width:
Original Height:
New Width:
New Height:
Constrain Proportions?: