PropResize Demo

This demo differs slightly from the code presented in the article Proportional Image Resizing within a Constrained Area. Rather than displaying all of the GIF files in the C:\ drive, this file displays all of the JPGs in the Web directory /images/demos.


story.castle.jpg5/11/2017 12:47:21 PM224980 x 128 16777216 colors
story.chest.jpg5/11/2017 12:47:21 PM4104128 x 127 256 colors
story.cottage.jpg5/11/2017 12:47:21 PM6913113 x 128 16777216 colors
story.exclamation.jpg5/11/2017 12:47:21 PM2830128 x 128 16777216 colors
story.forest.jpg5/11/2017 12:47:21 PM4796128 x 100 256 colors
story.he.jpg5/11/2017 12:47:21 PM293769 x 128 16777216 colors
story.island.jpg5/11/2017 12:47:21 PM5861128 x 85 16777216 colors
story.rose.jpg5/11/2017 12:47:21 PM189448 x 128 16777216 colors
story.she.jpg5/11/2017 12:47:21 PM315376 x 128 16777216 colors
story.slipper.jpg5/11/2017 12:47:21 PM2042128 x 70 16777216 colors
story.teapot.jpg5/11/2017 12:47:21 PM3641125 x 128 256 colors


Source Code for Demo:
<%
   ':::::::::::::::::::::::::::::::::::::::::::::::::::::::::
   ':::                                                   :::
   ':::  SCRIPT:   testpropresize.asp                     :::
   ':::  AUTHOR:   shaffer                                :::
   ':::  DATE:     11-Jan-01                              :::
   ':::  PURPOSE:  Test/show the operation of the resize  :::
   ':::            (proportional) function                :::
   ':::                                                   :::
   ':::::::::::::::::::::::::::::::::::::::::::::::::::::::::

   %>
     <!--#INCLUDE FILE='imgz.asp'-->
     <!--#INCLUDE FILE='propresize.asp'-->
   <%
   ' To test, we'll just try to show all files with a .GIF extension in
   ' the root of C: by fitting them to a common area (75 pixels x 45 pixels)
 
   dim objFSO, objF, objFC  
   dim f1, w, h, c, strType

   Set objFSO = CreateObject("Scripting.FileSystemObject")
   Set objF = objFSO.GetFolder(Server.MapPath("/images/demos/"))
   Set objFC = objF.Files

   response.write "<table border=""1"" cellpadding=""5"">"

   For Each f1 in objFC
     if instr(ucase(f1.Name), ".JPG") then
        response.write "<tr><td>" & f1.name & "</td><td>" & f1.DateCreated & _
                       "</td><td>" & f1.Size & "</td><td>"
 
        if gfxSpex(f1.Path, w, h, c, strType) = true then
           response.write w & " x " & h & " " & c & " colors</td>"
           response.write "<td><img src=""/images/demos/" & f1.Name & """ " & _
                          ImageResize(f1.Path, 75, 45) & " border=""1""></td>"
        else
           response.write " </td><td align=""center"">bad image</td>"
        end if
 
        response.write "</tr>"
 
     end if
   Next

   response.write "</table>"

   set objFC = nothing
   set objF = nothing
   set objFSO = nothing
%>


[Return to the article]