Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 12th, 2004, 11:52 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , .
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>

Reply With Quote
  #2 (permalink)  
Old October 12th, 2004, 01:02 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hey,

Looks like it scales images based on certain factors.

Brian
Reply With Quote
  #3 (permalink)  
Old October 12th, 2004, 04:08 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , .
Posts: 347
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Adam H-W
Default

how do you mean?

Reply With Quote
  #4 (permalink)  
Old October 13th, 2004, 07:47 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 07:28 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.