Go Back   Computer Forums > Web Design | Website Development > Web Programming
Click Here to Login
Join Computer forums Today


Reply
 
Thread Tools Search this Thread Display Modes
 
Old 10-26-2004, 01:56 PM   #1
Beta Member
 
ir2bg's Avatar
 
Join Date: Oct 2004
Posts: 2
Default ASPImage not creating images script error, help!

1. This is regarding my copy of ASPImage v2.x

2. Below is area of my my script page with the corresponding error line number. (I will post the entire script on the first responce to this post)

3. I recieve this error message at upload:
"Microsoft _VBScript runtime error '800a000b'
Division by zero
/admin/ProductsImagesInsert.asp, line 194 "
4. My server's OS is: Windows2000

5. My server's IIS is: IIS5

6. I was initially getting: "Server object error 80040154." until my server company restarted their server for me. Now I get the new, afformention: "Microsoft _VBScript runtime error '800a000b' Division by zero /admin/ProductsImagesInsert.asp, line 194"

7. I have narrowed this down to being an error in creating or writing my different sized versions of the uploaded image and associated scripted name/nomenclature as from my ProductsImagesInsert.asp page because:
A. My image uploader records the uploaded Image ID, File Source Path, File Short Name wich includes the Image ID, and the Bytes Uploaded. The origional file is then uploaded to my ProductImages folder under the name of Work+Image ID#.jpg
B. The script worked on the last project I worked on (but on a different server). When it worked it wrote several different sized versions of the images and named them for example: Zoom"& ImageID & ".jpg" or Gallery"& ImageID & ".jpg"
C. It creates an image ID that is associated with the product information that is added to the database just prior to the second part of the multi-part form then allowing for the uploading of the associated product image. I can see that they are associated correctly when I go to edit the products image record as it show there the Product and associated image ID together.
D. I just spoke with my server host and made sure that I had write permissions for my Product Images folder. (although if you suspect it still might be that I would gladly check again.

8. I have attempted to un-comment out the variables Image.MaxX and Image.MaxY as they are both commented out so they have no value assigned them and I hoped mabee this woud do so. This script had functioned, however, with the script as is(with adresses changed) on another server. Unfortunatly when I uncomment out lines 87-92 it just moves the same error to line 206(the same line of code pretty much: Image.ResizeR intXSize, (intXSize / Image.MaxX) * Image.MaxY If I comment that section it just moves the error down to the next sabe line of code in the next section.

9. PLEASE, if you can not help could you be so kind as to inform as such. Any assistance would be greatly appreciated!


This is the script area I get the error message:

187' strMessage = "Steve's Widget Factory" & vbCrLf & "123 Park Avenue" & _
188' VbCrLf & "Anytown, USA 012345"
189
190' Image.MaxX = Image.TextWidth (strMessage)
191' Image.MaxY = Image.TextHeight (strMessage)
192
193
194 Image.ResizeR intXSize, (intXSize / Image.MaxX) * Image.MaxY
195 Image.FileName = "D:\Inetpub\wwwroot\woodstockearth\ProductImages\Z oom"& ImageID & ".jpg"
196 Image.SaveImage
197' Response.Write "<CENTER>" & Image.FileName & "
"
198 Set Image = nothing
__________________

ir2bg is offline   Reply With Quote
Old 10-26-2004, 01:57 PM   #2
Beta Member
 
ir2bg's Avatar
 
Join Date: Oct 2004
Posts: 2
Default The entire script page with error (starting at line1)

<%
Dim ImageID
ImageID = Request("ImageID")
response.Write("ImageID:" & ImageID)
ProductID = Request("ProductID")
response.Write("ProductID:" & ProductID)
Dim intXSize
'DIM Photographer
Photographer= request.Querystring("Photographer")
' response.write("Photographer."& Photographer & ".LEN(Photographer)" & LEN(Photographer))
DIM CopyrightHolder
CopyrightHolder = request.Querystring("CopyrightHolder")
' response.Write("CopyrightHolderyy:" & CopyrightHolder )
%>
<%
'Dim rsOrders__MMColParam
'rsOrders__MMColParam = "1"
'If (Request.form("orderNumber") <> "") Then
' rsOrders__MMColParam = Request.form("orderNumber")
'End If
%>
<!--#include file="Loader.asp"-->
<%
Response.Buffer = True
DIM PageLink
pageLink = "ImagesEdit.asp?ImageID="& ImageID ' load object
' response.Write("pageLink :" & pageLink )

Dim load
Set load = new Loader

' calling initialize method
load.initialize
' File binary data
Dim fileData
fileData = load.getFileData("file")
' File name
Dim fileName
fileName = LCase(load.getFileName("file"))
' File path
Dim filePath
filePath = load.getFilePath("file")
' File path complete
Dim filePathComplete
filePathComplete = load.getFilePathComplete("file")
' File size
Dim fileSize
fileSize = load.getFileSize("file")
' File size translated
Dim fileSizeTranslated
fileSizeTranslated = load.getFileSizeTranslated("file")
' Content Type
Dim contentType
contentType = load.getContentType("file")
' No. of Form elements
Dim countElements
countElements = load.Count
' Value of text input field "name"


Dim nameInput
nameInput = load.getValue("name")
' Path where file will be uploaded
Dim shortFileName
shortFileName = "Work" & ImageID & ".jpg"
Dim pathToFile
pathToFile = Server.mapPath("..\..\ProductImages") & "\" & shortFileName
' Uploading file data
Dim fileUploaded
fileUploaded = load.saveToFile ("file", pathToFile)



' destroying load object
Set load = Nothing
%>

<html>
<head>
<title>File Uploaded</title>
<style>
body, input, td { font-family:verdana,arial; font-size:10pt; }
</style>
<meta name="Microsoft Theme" content="none, default">
</head>
<body>
<!--webbot bot="Include" U-Include="ProductsMenuItems.htm" TAG="BODY" --><p align="center">
<font size="5"><b>Product</b></font><b><font size="5"> Image Uploaded</font></b>
</p>

<table width="700" border="1" align="center">
<tr>
<td>Image ID:</td><td><%=ImageID %> </td>
<tr>
<td>File Source Path</td><td><%= filePathComplete %> </td>
<tr>
<td>File Short Name</td><td><%= shortFileName %> </td>
</tr>


</tr><tr>
<td>Bytes Uploaded</td><td><%= fileSize %> </td>
</tr>
</table>
<p align="center">

<span style="visibility: hidden">
<b><font face="Arial"><a href="../../thisProduct.asp?ProductID=<%=ProductID%>">Click to
Continue to View Public Product Record</a></font></b></span>






<b><font face="Arial"><a href="ImagesEdit.asp?ImageID=<%= ImageID%>">Click to
Continue and Edit this Image's Description Details</a></font></b>



</p>



<%

Set Image = Server.CreateObject("AspImage.Image")
Image.AutoSize = false
Image.LoadImage("D:\Inetpub\wwwroot\woodstockearth \ProductImages\Work"& ImageID & ".jpg")
Image.PadSize = 0
Image.DPI = 72
intXSize = 650

rem ************************************************** ********************
rem * Set various font parameters
rem ************************************************** ********************
' Image.FontColor = vbYellow
' Image.Italic = True
' Image.Bold = True
' Image.FontName = "Arial"
' Image.FontSize = 12
' Image.PadSize = 10

rem ************************************************** ********************
rem * Calculate the size of the text info is and set the image to this size
rem * (this has to be done since we want to fill the area with a gradient)
rem * This demonstrates a multi-line text string
rem ************************************************** ********************
' strMessage = "Steve's Widget Factory" & vbCrLf & "123 Park Avenue" & _
' VbCrLf & "Anytown, USA 012345"

' Image.MaxX = Image.TextWidth (strMessage)
' Image.MaxY = Image.TextHeight (strMessage)


Image.ResizeR intXSize, (intXSize / Image.MaxX) * Image.MaxY
Image.FileName = "D:\Inetpub\wwwroot\woodstockearth\ProductImages\Z oom"& ImageID & ".jpg"
Image.SaveImage
' Response.Write "<CENTER>" & Image.FileName & "
"
Set Image = nothing

Set Image = Server.CreateObject("AspImage.Image")
Image.AutoSize = false
Image.LoadImage("D:\Inetpub\wwwroot\woodstockearth \ProductImages\Work"& ImageID & ".jpg")
Image.PadSize = 0
Image.DPI = 72
intXSize = 465
Image.ResizeR intXSize, (intXSize / Image.MaxX) * Image.MaxY
Image.FileName = "D:\Inetpub\wwwroot\woodstockearth\ProductImages\P roduct"& ImageID & ".jpg"
Image.SaveImage
' Response.Write Image.FileName & "
"
Set Image = nothing

Set Image = Server.CreateObject("AspImage.Image")
Image.AutoSize = false
Image.LoadImage("D:\Inetpub\wwwroot\woodstockearth \ProductImages\Work"& ImageID & ".jpg")
Image.PadSize = 0
Image.DPI = 72
intXSize = 235
Image.ResizeR intXSize, (intXSize / Image.MaxX) * Image.MaxY
Image.FileName = "D:\Inetpub\wwwroot\woodstockearth\ProductImages\G allery"& ImageID & ".jpg"
Image.SaveImage
' Response.Write Image.FileName & "
"
Set Image = nothing

Set Image = Server.CreateObject("AspImage.Image")
Image.AutoSize = false
Image.LoadImage("D:\Inetpub\wwwroot\woodstockearth \ProductImages\Work"& ImageID & ".jpg")
Image.PadSize = 0
Image.DPI = 72
intXSize = 145
Image.ResizeR intXSize, (intXSize / Image.MaxX) * Image.MaxY
Image.FileName = "D:\Inetpub\wwwroot\woodstockearth\ProductImages\M iniGallery"& ImageID & ".jpg"
Image.SaveImage
Set Image = nothing

Set Image = Server.CreateObject("AspImage.Image")
Image.AutoSize = false
Image.LoadImage("D:\Inetpub\wwwroot\woodstockearth \ProductImages\Work"& ImageID & ".jpg")
Image.PadSize = 0
Image.DPI = 72
intXSize = 45
Image.ResizeR intXSize, (intXSize / Image.MaxX) * Image.MaxY
Image.FileName = "D:\Inetpub\wwwroot\woodstockearth\ProductImages\P lan"& ProductID & ".jpg"
Image.SaveImage
Set Image = nothing


%>

<div align="center">
<table border="2" cellpadding="0" cellspacing="0" width="90%">
<tr>
<td width="30%" valign="top" align="right">Size</td>
<td width="70%" valign="top" align="left">Converted Image results</td>
</tr>
<tr>
<td width="30%" valign="top" align="right">MiniGallery </td>
<td width="70%" valign="top" align="left">
<img border="0" src="../../ProductImages/Minigallery<%=ImageID %>.jpg" align="top" alt=""></td>
</tr>
<tr>
<td width="30%" valign="top" align="right">Gallery</td>
<td width="70%" valign="top" align="left">
<img border="0" src="../../ProductImages/Gallery<%=ImageID %>.jpg" align="top" alt=""></td>
</tr>
<tr>
<td width="30%" valign="top" align="right">Product</td>
<td width="70%" valign="top" align="left">
<img border="0" src="../../ProductImages/Product<%=ImageID %>.jpg" align="top" alt=""></td>
</tr>
<tr>
<td width="30%" valign="top" align="right" style="font-family: verdana,arial; font-size: 10pt">Zoom</td>
<td width="70%" valign="top" align="left" style="font-family: verdana,arial; font-size: 10pt">
<img border="0" src="../../ProductImages/Zoom<%=ImageID %>.jpg" align="top" alt=""></td>
</tr>
<tr>
<td width="30%" valign="top" align="right">Plan </td>
<td width="70%" valign="top" align="left">
<img border="0" src="../../ProductImages/Plan<%=ProductID %>.jpg" align="top" alt=""></td>
</tr>
</table>
</div>
<p align="center">ProductsImageInsert.asp</p>
</p>
</body>
</html>
__________________

ir2bg is offline   Reply With Quote
Old 10-26-2004, 02:48 PM   #3
Site Team
 
root's Avatar
 
Join Date: Mar 2004
Posts: 8,003
Default Re: ASPImage not creating images script error, help!

The error is divide by zero on line 194...
Code:
190' Image.MaxX = Image.TextWidth (strMessage) 
191' Image.MaxY = Image.TextHeight (strMessage) 
192 
193 
194 Image.ResizeR intXSize, (intXSize / Image.MaxX) * Image.MaxY
obviously the Image.MaxX is zero (is the lin 190 commented? this sets the vaule, if it's not set then thats your problem!)
so try either...

Code:
190 Image.MaxX = Image.TextWidth (strMessage) 
191 Image.MaxY = Image.TextHeight (strMessage) 
192 
193 
194 Image.ResizeR intXSize, (intXSize / Image.MaxX) * Image.MaxY
or ...

Code:
190 Image.MaxX = Image.TextWidth (strMessage)+1 
191 Image.MaxY = Image.TextHeight (strMessage)+1 
192 
193 
194 Image.ResizeR intXSize, (intXSize / Image.MaxX) * Image.MaxY
this will ensure that the vaule image.MaxX is not zero.
root is offline   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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off



All times are GMT -5. The time now is 03:59 AM.


Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0