klegger
06-21-2005, 08:46 AM
Hello all:
I am still learning the workings of ASPJpeg and ASPUpload. I need the following:
A member gallery that allows me to upload 4 images, and company information for each particular company. I then need to be able to display a particular company with its 4 images. I am using the following code for the uploader ...
<html>
<body>
<%
'Initial Variables
Dim strConnect
'On Error Resume Next
%>
<!-- #include file="Connections/datastore.asp" -->
<!-- METADATA TYPE="typelib" FILE="C:\Program Files\Common Files\System\ado\msado15.dll" -->
<%
Set Upload = Server.CreateObject("Persits.Upload")
Set Jpeg = Server.CreateObject("Persits.Jpeg")
Upload.Save Server.MapPath("gallery\")
For Each File in Upload.Files
If File.ImageType <> "JPG" Then
Response.Write "This is not a JPEG image."
File.Delete
Response.End
End If
Jpeg.Open File.Path
L = 75
Jpeg.Quality = 90
Jpeg.Interpolation = 1
Jpeg.Width = L
Jpeg.Height = Jpeg.OriginalHeight * L / Jpeg.OriginalWidth
Jpeg.Save Server.MapPath("gallery") & "\small_" & File.FileName
%>
<%
companyName = Upload.Form("companyName")
address = Upload.Form("address")
addressFr = Upload.Form("addressFr")
telephone = Upload.Form("telephone")
fax = Upload.Form("fax")
tollfree = Upload.Form("tollfree")
desc = Upload.Form("desc")
descFr = Upload.Form("descFr")
imagePath = "gallery" & "\" & File.Filename
imagePathSmall = "gallery" & "\" & "small_" & File.Filename
Dim imageRS
Set imageRS = Server.CreateObject ("ADODB.Recordset")
imageRS.Open "images", strConnect, adOpenStatic, adLockOptimistic, adCmdTable
if imageRS.BOF then
else
imageRS.MoveLast
end if
imageRS.AddNew
imageRS("companyName") = companyName
imageRS("address") = address
imageRS("addressFr") = addressFr
imageRS("telephone") = telephone
imageRS("fax") = fax
imageRS("tollfree") = tollfree
imageRS("desc") = desc
imageRS("descFr") = descFr
imageRS("imagePath") = imagePath
imageRS("imagePathSmall") = imagePathSmall
imageRS.Update
imageRS.Close
Set imageRS = Nothing
%>
<IMG SRC="gallery/<% = "small_" & File.FileName %>">
<%
Next
%>
<% Response.Redirect("company_index.asp") %>
</body>
</html>
The trouble with this is the company information is being entered 4 times (once for each image), and I am not sure how to keep the 4 images grouped with the company information for each company.
Please help!
Kev,
I am still learning the workings of ASPJpeg and ASPUpload. I need the following:
A member gallery that allows me to upload 4 images, and company information for each particular company. I then need to be able to display a particular company with its 4 images. I am using the following code for the uploader ...
<html>
<body>
<%
'Initial Variables
Dim strConnect
'On Error Resume Next
%>
<!-- #include file="Connections/datastore.asp" -->
<!-- METADATA TYPE="typelib" FILE="C:\Program Files\Common Files\System\ado\msado15.dll" -->
<%
Set Upload = Server.CreateObject("Persits.Upload")
Set Jpeg = Server.CreateObject("Persits.Jpeg")
Upload.Save Server.MapPath("gallery\")
For Each File in Upload.Files
If File.ImageType <> "JPG" Then
Response.Write "This is not a JPEG image."
File.Delete
Response.End
End If
Jpeg.Open File.Path
L = 75
Jpeg.Quality = 90
Jpeg.Interpolation = 1
Jpeg.Width = L
Jpeg.Height = Jpeg.OriginalHeight * L / Jpeg.OriginalWidth
Jpeg.Save Server.MapPath("gallery") & "\small_" & File.FileName
%>
<%
companyName = Upload.Form("companyName")
address = Upload.Form("address")
addressFr = Upload.Form("addressFr")
telephone = Upload.Form("telephone")
fax = Upload.Form("fax")
tollfree = Upload.Form("tollfree")
desc = Upload.Form("desc")
descFr = Upload.Form("descFr")
imagePath = "gallery" & "\" & File.Filename
imagePathSmall = "gallery" & "\" & "small_" & File.Filename
Dim imageRS
Set imageRS = Server.CreateObject ("ADODB.Recordset")
imageRS.Open "images", strConnect, adOpenStatic, adLockOptimistic, adCmdTable
if imageRS.BOF then
else
imageRS.MoveLast
end if
imageRS.AddNew
imageRS("companyName") = companyName
imageRS("address") = address
imageRS("addressFr") = addressFr
imageRS("telephone") = telephone
imageRS("fax") = fax
imageRS("tollfree") = tollfree
imageRS("desc") = desc
imageRS("descFr") = descFr
imageRS("imagePath") = imagePath
imageRS("imagePathSmall") = imagePathSmall
imageRS.Update
imageRS.Close
Set imageRS = Nothing
%>
<IMG SRC="gallery/<% = "small_" & File.FileName %>">
<%
Next
%>
<% Response.Redirect("company_index.asp") %>
</body>
</html>
The trouble with this is the company information is being entered 4 times (once for each image), and I am not sure how to keep the 4 images grouped with the company information for each company.
Please help!
Kev,