Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 12th, 2004, 11:52 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 347
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Adam H-W
Default why won't this script work

Hi there

I've just dug out this script but I'm not sure what it's supposed to do - can anyone help? I think it's supposed to scale images depending on the resolution of the computer screen but when I try it, it doesn't seem to work. Can anyone shed some light on it: here it is; I've included all the html code too.

<%@ language=VBScript %>
<% option explicit %>
<HTML>
<HEAD>
<TITLE>Untitled-1</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
</HEAD>
<%
Sub SetScaleFactor(ByRef sngSFw, ByRef sngSFh, ByVal strWidth, ByVal strHeight, ByVal strDefWidth, ByVal strDefHeight)
   if (strWidth <> "") and (strheight <> "") then
      sngSFw = Csng(strWidth) / Csng(strDefWidth)
       sngSFh = Csng(strheight) / Csng(strDefHeight)
    else
       sngSFw = 1.0
        sngSFh = 1.0
    end if
End Sub
%><%
    'Sets the Scaling Factor
   Call SetScaleFactor(sngSFw, sngSFh, request.querystring("width"), request.querystring("height"), BASE_WIDTH, BASE_HEIGHT)

   Const BASE_WIDTH = "800"
    Const BASE_HEIGHT = "600"
   dim sngSFw, sngSFh

%>
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<td width="100%" height="100%" align="center" valign="top">
    <table width="<%=cint(991*sngSFw)%>" height="<%=cint(110*sngSFh)%>" border="0" cellpadding="0" cellspacing="0">
    <tr>
        <td rowspan="2" width="<%=cint(362*sngSFw)%>" height="<%=cint(110*sngSFh)%>"><img src="../images/slices_01.gif" width="100%" height="100%"></td>
        <td valign="top" width="<%=cint(337*sngSFw)%>" height="<%=cint(110*sngSFh)%>"><img src="../images/slices_02.gif" width="100%" height="100%"></td>
        <td rowspan="2" width="<%=cint(292*sngSFw)%>" height="<%=cint(110*sngSFh)%>"><img src="../images/slices_03.gif" width="100%" height="100%"></td>
    </tr>
    </table>
</td></tr>
</table>
</HTML>

 
Old October 12th, 2004, 01:02 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hey,

Looks like it scales images based on certain factors.

Brian
 
Old October 12th, 2004, 04:08 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 347
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Adam H-W
Default

how do you mean?

 
Old October 13th, 2004, 07:47 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

It takes the width/height, divides by a default width/height, which produces a scale factor (returned by byref). Then it takes the scale factor and scales the image by multiplying the scale factor against the images default height (the 337, 292, and the height of 110), so if you have an image and the scale factor calculates to 2, the image would be double the size of 337x110 and 292x110, so it would be 674x220 and 584x220. That is if the scale factor is equal on both sides.

Brian





Similar Threads
Thread Thread Starter Forum Replies Last Post
Make the tilde work on script element hpox ASP.NET 2.0 Basics 10 February 14th, 2011 03:00 PM
Chapter 1 Ctrl+F5 don't work, F5 does work? jimboak BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 7 June 29th, 2008 03:46 AM
Webuivalidation script doesnt work in netscape olambe BOOK: ASP.NET Website Programming Problem-Design-Solution 2 July 29th, 2004 07:30 AM
Call and run CGI script from a PHP script ... how? dbruins BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 1 June 10th, 2003 03:09 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.