Forums

ASP

This topic is locked

Thumbnails

Posted 03 Feb 2004 02:29:03
1
has voted
03 Feb 2004 02:29:03 David Forshaw posted:
Hi

Can you rename the thumbnails that smart image processor creates? Do you do this using the rename tool?

How?

I can rename the uploaded file but I cant rename the thumbnail that is created with it.

What it does is it keeps the original file name and just adds the _thumb to the end of the name of the created thumb image.

I want to rename the uploaded file (Done) and rename the created thumb image to the same name with the _thumb ending (Not Done)

Thanks

Replies

Replied 05 Feb 2004 12:19:08
05 Feb 2004 12:19:08 Patrick Woldberg replied:
This should work, I think the rename is placed wrong in the document, seems to happen sometimes. The rename must come before the resize.

--------------------------------------------------
Patrick Woldberg
Web Developer at Dynamic Zones
Manager at DMXzone.com
--------------------------------------------------
Replied 06 Feb 2004 01:26:58
06 Feb 2004 01:26:58 David Forshaw replied:
Hi

I tried to place the rename infront of the resize but now I dont get any thumbnails generated at all!

My deadline is comming up very soon so I was wondering if I post the code can you have a look at it for me.

I would really appreciate it.

Here it is, and thanks for the help!

David

<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/connPM.asp" -->
<!--#include file="ScriptLibrary/incPUAddOn.asp" -->
<!--#include file="ScriptLibrary/incResizeAddOn.asp" -->
<!--#include file="ScriptLibrary/incPureUpload.asp" -->
<%
'*** Pure ASP File Upload 2.1.7
Dim GP_uploadAction,UploadQueryString
PureUploadSetup
If (CStr(Request.QueryString("GP_upload") <> "" Then
Dim pau_thePath,pau_Extensions,pau_Form,pau_Redirect,pau_storeType,pau_sizeLimit,pau_nameConflict,pau_requireUpload,pau_minWidth,pau_minHeight,pau_maxWidth,pau_maxHeight,pau_saveWidth,pau_saveHeight,pau_timeout,pau_progressBar,pau_progressWidth,pau_progressHeight
pau_thePath = """upload/"" & UploadFormRequest(""sellerID""&""_""& Session(""svNewPropID""&""_""& Session(""ts"""
pau_Extensions = "GIF,JPG,JPEG,BMP,PNG"
pau_Form = "formSelling"
pau_Redirect = ""
pau_storeType = "path"
pau_sizeLimit = ""
pau_nameConflict = "uniq"
pau_requireUpload = "false"
pau_minWidth = ""
pau_minHeight = ""
pau_maxWidth = ""
pau_maxHeight = ""
pau_saveWidth = ""
pau_saveHeight = ""
pau_timeout = "900"
pau_progressBar = "blueFlashProgress.htm"
pau_progressWidth = "300"
pau_progressHeight = "100"

Dim RequestBin, UploadRequest
CheckPureUploadVersion 2.17
ProcessUpload pau_thePath,pau_Extensions,pau_Redirect,pau_storeType,pau_sizeLimit,pau_nameConflict,pau_requireUpload,pau_minWidth,pau_minHeight,pau_maxWidth,pau_maxHeight,pau_saveWidth,pau_saveHeight,pau_timeout
end if
%>
<%
' *** Rename Uploaded Files 1.7.0
If (CStr(Request.QueryString("GP_upload") <> "" Then
Dim REUF_path, REUF_nameConflict, REUF_renameMask
REUF_path = ""
REUF_nameConflict = "uniq"
REUF_renameMask = "im.##ext##"
RenameUploadedFiles REUF_path,REUF_nameConflict,REUF_renameMask
end if
%>
<%
' *** Smart Image Processor 1.1.2
If (CStr(Request.QueryString("GP_upload") <> "" Then
Dim RUF_Component, RUF_DotNetResize, RUF_ResizeImages, RUF_AspectImages, RUF_maxWidth, RUF_maxHeight, RUF_Quality, RUF_MakeThumb, RUF_AspectThumb, RUF_Suffix, RUF_maxWidthThumb, RUF_maxHeightThumb, RUF_QualityThumb, RUF_RedirectURL
RUF_Component = "PICPROC"
RUF_DotNetResize = "ScriptLibrary/ResizeImage.aspx"
RUF_ResizeImages = true
RUF_AspectImages = true
RUF_maxWidth = "640"
RUF_maxHeight = "480"
RUF_Quality = "80"
RUF_MakeThumb = true
RUF_AspectThumb = true
RUF_Suffix = "_thumb"
RUF_maxWidthThumb = "102"
RUF_maxHeightThumb = "73"
RUF_QualityThumb = "80"
RUF_RedirectURL = ""
if RUF_ResizeImages then
ResizeUploadedFiles RUF_Component, RUF_DotNetResize, pau_thePath, "", RUF_maxWidth, RUF_maxHeight, RUF_Quality, true, pau_saveWidth, pau_saveHeight, RUF_AspectImages, pau_nameConflict, ""
end if
if RUF_MakeThumb then
ResizeUploadedFiles RUF_Component, RUF_DotNetResize, pau_thePath, RUF_Suffix, RUF_maxWidthThumb, RUF_maxHeightThumb, RUF_QualityThumb, false, pau_saveWidth, pau_saveHeight, RUF_AspectThumb, pau_nameConflict, ""
end if
if RUF_RedirectURL <> "" then
Response.Redirect RUF_RedirectURL
end if
end if
%>

<%
' *** Edit Operations: (Modified for File Upload) declare variables

MM_editAction = CStr(Request.ServerVariables("URL") 'MM_editAction = CStr(Request("URL")
If (UploadQueryString <> "" Then
MM_editAction = MM_editAction & "?" & UploadQueryString
End If

' boolean to abort record edit
MM_abortEdit = false

' query string to execute
MM_editQuery = ""
%>
<%
' *** Insert Record: (Modified for File Upload) set variables

If (CStr(UploadFormRequest("MM_insert") <> "" Then

MM_editConnection = MM_connPM_STRING
MM_editTable = "tbl_properties"
MM_editRedirectUrl = ""
MM_fieldsStr = "sellerFirstName|value|sellerLastName|value|sellerEmail|value|sellerPhone|value|propState|value|propSuburb|value|propStreetNumber|value|propStreet|value|propStreetType|value|propPostCode|value|propType|value|propPrice|value|propBedrooms|value|propBathrooms|value|propGarage|value|propHeading|value|propDescription|value|propFeatures|value|virtualTour|value|mainImage|value|image1|value|image2|value|image3|value|image4|value|image5|value|image6|value|image7|value|image8|value|image9|value|sellerID|value|online|value|dateAdded|value"
MM_columnsStr = "sellerFirstName|',none,''|sellerLastName|',none,''|sellerEmail|',none,''|sellerPhone|',none,''|propState|',none,''|propSuburb|',none,''|propStreetNumber|',none,''|propStreet|',none,''|propStreetType|',none,''|propPostCode|none,none,NULL|propType|',none,''|propPrice|',none,''|propBedrooms|',none,''|propBathrooms|',none,''|propGarage|',none,''|propHeading|',none,''|propDescription|',none,''|propFeatures|',none,''|virtualTour|',none,''|mainImage|',none,''|image1|',none,''|image2|',none,''|image3|',none,''|image4|',none,''|image5|',none,''|image6|',none,''|image7|',none,''|image8|',none,''|image9|',none,''|sellerID|',none,''|onlineStatus|',none,''|dateAdded|',none,''"

' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, "|"
MM_columns = Split(MM_columnsStr, "|"

' set the form values
For i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_fields(i+1) = CStr(UploadFormRequest(MM_fields(i)))
Next

' append the query string to the redirect URL
If (MM_editRedirectUrl <> "" And UploadQueryString <> "" Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And UploadQueryString <> "" Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & UploadQueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & UploadQueryString
End If
End If

End If
%>
<%
' *** Insert Record: (Modified for File Upload) construct a sql insert statement and execute it

If (CStr(UploadFormRequest("MM_insert") <> "" Then

' create the sql insert statement
MM_tableValues = ""
MM_dbValues = ""
For i = LBound(MM_fields) To UBound(MM_fields) Step 2
FormVal = MM_fields(i+1)
MM_typeArray = Split(MM_columns(i+1),","
Delim = MM_typeArray(0)
If (Delim = "none" Then Delim = ""
AltVal = MM_typeArray(1)
If (AltVal = "none" Then AltVal = ""
EmptyVal = MM_typeArray(2)
If (EmptyVal = "none" Then EmptyVal = ""
If (FormVal = "" Then
FormVal = EmptyVal
Else
If (AltVal <> "" Then
FormVal = AltVal
ElseIf (Delim = "'" Then ' escape quotes
FormVal = "'" & Replace(FormVal,"'","''" & "'"
Else
FormVal = Delim + FormVal + Delim
End If
End If
If (i <> LBound(MM_fields)) Then
MM_tableValues = MM_tableValues & ","
MM_dbValues = MM_dbValues & ","
End if
MM_tableValues = MM_tableValues & MM_columns(i)
MM_dbValues = MM_dbValues & FormVal
Next
MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & " values (" & MM_dbValues & ""

If (Not MM_abortEdit) Then
' execute the insert
Set MM_editCmd = Server.CreateObject("ADODB.Command"
MM_editCmd.ActiveConnection = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
'MM_editCmd.ActiveConnection.Close

If (MM_editRedirectUrl <> "" Then
'Response.Redirect(MM_editRedirectUrl)
End If
End If

End If
%>
<%
MyDate = Date
MyTime = Time
mm = Month(MyDate)
if mm < 10 then
mm = "0" & mm
end if
dd = Day(MyDate)
if dd < 10 then
dd = "0" & dd
end if
yy = Right(Year(MyDate),2)
hh = Hour(MyTime)
if hh < 10 then
hh = "0" & hh
end if
nn = Minute(MyTime)
if nn < 10 then
nn = "0" & nn
end if
ss = Second(MyTime)
if ss < 10 then
ss = "0" & ss
end if
session("ts" = dd & mm & yy & hh & nn & ss
session("today" = mm & "/" & dd & "/" & yy
%>
<%
If (CStr(UploadFormRequest("MM_insert") <> "" Then
set rsNewProp = Server.CreateObject("ADODB.Recordset"
rsNewProp.ActiveConnection = MM_editCmd.ActiveConnection
rsNewProp.Source = "SELECT max(propID) as MaxID FROM tbl_properties"
rsNewProp.CursorType = 0
rsNewProp.CursorLocation = 2
rsNewProp.LockType = 3
rsNewProp.Open()
Session("svNewPropID"=rsNewProp("MaxID"
'Response.Redirect(MM_editRedirectUrl)
end if
%>
<%
Dim rsSeller__MMColParam
rsSeller__MMColParam = "1"
if (Session("MM_Username" <> "" then rsSeller__MMColParam = Session("MM_Username"
%>
<%
set rsSeller = Server.CreateObject("ADODB.Recordset"
rsSeller.ActiveConnection = MM_connPM_STRING
rsSeller.Source = "SELECT * FROM tbl_sellers WHERE emailAddress = '" + Replace(rsSeller__MMColParam, "'", "''" + "'"
rsSeller.CursorType = 0
rsSeller.CursorLocation = 2
rsSeller.LockType = 3
rsSeller.Open()
rsSeller_numRows = 0
%>
<%
set rsPopCount = Server.CreateObject("ADODB.Recordset"
rsPopCount.ActiveConnection = MM_connPM_STRING
rsPopCount.Source = "SELECT propID FROM tbl_properties"
rsPopCount.CursorType = 0
rsPopCount.CursorLocation = 2
rsPopCount.LockType = 3
rsPopCount.Open()
rsPopCount_numRows = 0
%>
<%
' *** Mail Uploaded Files 1.7.0
If (CStr(Request.QueryString("GP_upload") <> "" Then
Dim MUF_path, MUF_FromName, MUF_FromEmail, MUF_ToName, MUF_ToEmail, MUF_Bcc, MUF_Subject, MUF_Body, MUF_SendHtml, MUF_checkErrors, MUF_deleteFiles, MUF_RedirectURL, MUF_SmtpServer, MUF_MailerType
MUF_path = ""
MUF_FromName = rsSeller.Fields.Item("firstName".Value & rsSeller.Fields.Item("lastName".Value
MUF_FromEmail = rsSeller.Fields.Item("emailAddress".Value
MUF_ToName = "Property Market"
MUF_ToEmail = " "
MUF_Bcc = ""
MUF_Subject = "New Property Submission"
MUF_Body = "<b>Property Submission from Property Market</b>" & vbCRLF & "<BR>" & vbCRLF & "<BR>" & vbCRLF & "<b>Property Number:</b> " & (Session("svNewPropID") & "" & vbCRLF & "<BR>" & vbCRLF & "<b>Date: </b>" & (Session("today") & "" & vbCRLF & "<BR>" & vbCRLF & "<BR>" & vbCRLF & "<b>Property Type: </b>" & (UploadFormRequest("propType") & "" & vbCRLF & "<BR>" & vbCRLF & "<BR>" & vbCRLF & "<b>Sellers Details</b>" & vbCRLF & "<BR>" & vbCRLF & "<b>Seller ID:</b> " & (rsSeller.Fields.Item("sellerID".Value) & "" & vbCRLF & "<BR>" & vbCRLF & "<b>Name:</b> " & (rsSeller.Fields.Item("firstName".Value) & " " & (rsSeller.Fields.Item("lastName".Value) & "" & vbCRLF & "<BR>" & vbCRLF & "<b>Email:</b> " & (rsSeller.Fields.Item("emailAddress".Value) & "" & vbCRLF & "<BR>" & vbCRLF & "<b>Contact Number:</b> " & (UploadFormRequest("sellerPhone") & "" & vbCRLF & "<BR>" & vbCRLF & "<BR>" & vbCRLF & "<b>Credit Card Details</b>" & vbCRLF & "<BR>" & vbCRLF & "<b>Card Type:</b> " & (UploadFormRequest("cardType") & "" & vbCRLF & "<BR>" & vbCRLF & "<b>Card Number:</b> " & (UploadFormRequest("cardNumber") & "" & vbCRLF & "<BR>" & vbCRLF & "<b>Card Expiry Date:</b> " & (UploadFormRequest("cardExpMnth") & " - " & (UploadFormRequest("cardExpYear") & "" & vbCRLF & "<BR>" & vbCRLF & "<b>Card 3 Digital Number:</b> " & (UploadFormRequest("cardCode") & "" & vbCRLF & "<BR>" & vbCRLF & "<b>Name on Card:</b> " & (UploadFormRequest("cardName") & "" & vbCRLF & "<BR><BR>"
MUF_SendHtml = true
MUF_checkErrors = false
MUF_deleteFiles = false
MUF_RedirectURL = "sellerPropSubSuccess.asp"
MUF_SmtpServer = ""
MUF_MailerType = "CDO"
MailUploadedFiles MUF_path, MUF_FromName, MUF_FromEmail, MUF_ToName, MUF_ToEmail, MUF_Bcc, MUF_Subject, MUF_Body, MUF_SendHtml, MUF_checkErrors, MUF_deleteFiles, MUF_RedirectURL, MUF_SmtpServer, MUF_MailerType
end if
%>
Replied 09 Feb 2004 05:23:44
09 Feb 2004 05:23:44 David Forshaw replied:
Hi

I tried to do this whole thing again but it still dont work.

Can somebody tell me if this is possible
Replied 10 Feb 2004 12:01:58
10 Feb 2004 12:01:58 Patrick Woldberg replied:
The code is in the right place, so that is not the cause. I will need to do some testing to see if it is a bug in the extension.

--------------------------------------------------
Patrick Woldberg
Web Developer at Dynamic Zones
Manager at DMXzone.com
--------------------------------------------------
Replied 11 Feb 2004 01:01:01
11 Feb 2004 01:01:01 David Forshaw replied:
Thanks.

I would appreciate that.

Could you please let me know when you get your results.

Regards
David
Replied 08 Mar 2004 13:28:00
08 Mar 2004 13:28:00 alberto catagni replied:
I resolved the problem by putting after the pure asp upload 217 the code Rename uploaded file and after the code smart image processor (for resizing).
In this way are executed:
1. upload file
2. rename uploaded file
3. resize and generate thumnail of the uploaded and renamed file

here the code:
<pre id=code><font face=courier size=2 id=code> &lt;!--#include file="../ScriptLibrary/incPureUpload.asp" --&gt;
&lt;!--#include file="../ScriptLibrary/incResizeAddOn.asp" --&gt;
&lt;!--#include file="../ScriptLibrary/incPUAddOn.asp" --&gt;
&lt;%
'*** Pure ASP File Upload 2.1.7
Dim GP_uploadAction,UploadQueryString
PureUploadSetup
If (CStr(Request.QueryString("GP_upload") &lt;&gt; "" Then
Dim pau_thePath,pau_Extensions,pau_Form,pau_Redirect,pau_storeType,pau_sizeLimit,pau_nameConflict,pau_requireUpload,pau_minWidth,pau_minHeight,pau_maxWidth,pau_maxHeight,pau_saveWidth,pau_saveHeight,pau_timeout,pau_progressBar,pau_progressWidth,pau_progressHeight
pau_thePath = """../images/prod"""
pau_Extensions = "JPG"
pau_Form = "UPLOAD"
pau_Redirect = ""
pau_storeType = "file"
pau_sizeLimit = ""
pau_nameConflict = "error"
pau_requireUpload = "true"
pau_minWidth = ""
pau_minHeight = ""
pau_maxWidth = ""
pau_maxHeight = ""
pau_saveWidth = ""
pau_saveHeight = ""
pau_timeout = "600"
pau_progressBar = "fileCopyProgress.htm"
pau_progressWidth = "300"
pau_progressHeight = "100"

Dim RequestBin, UploadRequest
CheckPureUploadVersion 2.17
ProcessUpload pau_thePath,pau_Extensions,pau_Redirect,pau_storeType,pau_sizeLimit,pau_nameConflict,pau_requireUpload,pau_minWidth,pau_minHeight,pau_maxWidth,pau_maxHeight,pau_saveWidth,pau_saveHeight,pau_timeout
end if
%&gt;
&lt;%
' *** Rename Uploaded Files 1.7.0
If (CStr(Request.QueryString("GP_upload") &lt;&gt; "" Then
Dim REUF_path, REUF_nameConflict, REUF_renameMask
REUF_path = "../images/prod"
REUF_nameConflict = "error"
REUF_renameMask = application("USER" & "CLI_" & request.QueryString("ART" & ".##ext##"
RenameUploadedFiles REUF_path,REUF_nameConflict,REUF_renameMask
end if
%&gt;&lt;%
' *** Smart Image Processor 1.1.2
If (CStr(Request.QueryString("GP_upload") &lt;&gt; "" Then
Dim RUF_Component, RUF_DotNetResize, RUF_ResizeImages, RUF_AspectImages, RUF_maxWidth, RUF_maxHeight, RUF_Quality, RUF_MakeThumb, RUF_AspectThumb, RUF_Suffix, RUF_maxWidthThumb, RUF_maxHeightThumb, RUF_QualityThumb, RUF_RedirectURL
RUF_Component = "AUTO"
RUF_DotNetResize = "../ScriptLibrary/ResizeImage.aspx"
RUF_ResizeImages = true
RUF_AspectImages = true
RUF_maxWidth = "320"
RUF_maxHeight = ""
RUF_Quality = "75"
RUF_MakeThumb = true
RUF_AspectThumb = false
RUF_Suffix = "_small"
RUF_maxWidthThumb = "50"
RUF_maxHeightThumb = "38"
RUF_QualityThumb = "70"
RUF_RedirectURL = ""
if RUF_ResizeImages then
ResizeUploadedFiles RUF_Component, RUF_DotNetResize, pau_thePath, "", RUF_maxWidth, RUF_maxHeight, RUF_Quality, true, pau_saveWidth, pau_saveHeight, RUF_AspectImages, pau_nameConflict, ""
end if
if RUF_MakeThumb then
ResizeUploadedFiles RUF_Component, RUF_DotNetResize, pau_thePath, RUF_Suffix, RUF_maxWidthThumb, RUF_maxHeightThumb, RUF_QualityThumb, false, pau_saveWidth, pau_saveHeight, RUF_AspectThumb, pau_nameConflict, ""
end if
if RUF_RedirectURL &lt;&gt; "" then
Response.Redirect RUF_RedirectURL
end if
end if
%&gt;</font id=code></pre id=code>
Replied 09 Mar 2004 00:43:08
09 Mar 2004 00:43:08 David Forshaw replied:
And does this work?

Do the original files and the thumbnails get resized and renamed?

Because I tried this and it didnt work!

Ill give it another go like the way you say and see.

This is becomeing a real headache for me. I thought that this would happen automatically.

What happens if this doesnt work? Are DMX Zone working on fixing it?

Who can I ask?

Thanks
Enzo
Replied 20 Jul 2004 06:26:10
20 Jul 2004 06:26:10 Mark Gwaltney replied:
Did anyone ever finally resolve this issue. I am currently having the same issue and I have tried the fixes listed in this thread.

Thx,
Mark
Replied 20 Jul 2004 06:34:02
20 Jul 2004 06:34:02 David Forshaw replied:
No one has sent me a resolve for this.

It is certainly a problem that needs fixing.

I had to leave it out of the last job but I have a new job that will need the same type of thing to happen.

Can you please email me if you find a solution to this.

That would be greatly appreciated.

Enzo
Replied 20 Jul 2004 06:46:39
20 Jul 2004 06:46:39 Mark Gwaltney replied:
I would appreciate any technical support. Anyone from DMXZone have any ideas?

Edited by - mgwaltney on 20 Jul 2004 17:15:00
Replied 20 Jul 2004 22:37:46
20 Jul 2004 22:37:46 Lee Diggins replied:
Try posting here:

www.dmxzone.com/forum/default.asp?NewsId=1622

Digga

Sharing Knowledge Saves Valuable Time!!!
Replied 25 Jul 2004 10:24:30
25 Jul 2004 10:24:30 Mark Gwaltney replied:
This fix from Camillah at DMXzone did the trick........

In the folder 'ScriptLibrary' find the file 'incResizeAddOn.asp' and open it in a text editor.

Change line 475:

RUF_fileName = UploadRequest.Item(RUF_curKey).Item("FileName"

into

RUF_fileName = RUF_curName

Many thx to Camillah,
Mark

Reply to this topic