Smart Image Processor ASP 2 Support Product Page

This topic was archived

Storing Image Width/Height

Reported 25 Jul 2008 04:33:37
1
has this problem
25 Jul 2008 04:33:37 phillip moraghan posted:
I am currently using Pure ASP Upload 2.x and Smart Image Processor 2.5. I notice with SIP 2.5 I can no longer store image widths and height in hidden text fields and insert into a database. If I roll back to SIP 1.x, the values are successfully stored.

Can you please advise what may be the problem? If I upgraded to Pure ASP Upload 3.x would this problem be fixed?

Replies

Replied 28 Jul 2008 16:18:12
28 Jul 2008 16:18:12 Miroslav Zografski replied:
Hi Phillip,

Sip ASP 2.5 is not supporting PAU2.X. Als o new browser technology is preventing PAU 2.X from Inserting and Updateing Data records.
So we advise you to upgrade to PAU 3. You'll have no problems with inserting and updating.

Regards,


M.Zografski

-----------------------------------
DMXZone.com Support Team
-----------------------------------
Replied 29 Jul 2008 13:55:09
29 Jul 2008 13:55:09 phillip moraghan replied:
Thanks. I have now upgraded to PAU3...there is no option to store image widths and image heights? Why has this been removed. I am not happy.
Replied 29 Jul 2008 14:41:55
29 Jul 2008 14:41:55 Miroslav Zografski replied:
Hi Phillip,

They are directly added to Binding Tab, so you can directly add them to a hidden fields or wherever you like.

Regards,


M.Zografski

-----------------------------------
DMXZone.com Support Team
-----------------------------------
Replied 29 Jul 2008 20:45:44
29 Jul 2008 20:45:44 CK Nyak replied:
I am having the exact same problem. How do I store the resized height and width. I can only store the actual file height and width, but after resize I get null values in the db.
Replied 30 Jul 2008 15:57:33
30 Jul 2008 15:57:33 Miroslav Zografski replied:
Hi CK,

Witch versions of extensions you have ?

Regards,


M.Zografski

-----------------------------------
DMXZone.com Support Team
-----------------------------------
Replied 31 Jul 2008 00:36:10
31 Jul 2008 00:36:10 CK Nyak replied:
I have PU3 and SIP2. Any help will be appreciated.

Ck

<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
Hi CK,

Witch versions of extensions you have ?

Regards,


M.Zografski

-----------------------------------
DMXZone.com Support Team
-----------------------------------
<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
Replied 31 Jul 2008 11:12:13
31 Jul 2008 11:12:13 Miroslav Zografski replied:
Hi All,

It appears that there is code mismatch in that part and the required code for that function is placed on wrong place.

So in order to inser resized image dimentions into database you need to locate the following code and place it right after SIP 2.5 code.
<pre id=code><font face=courier size=2 id=code>
if pau.Done then
SetUploadFormRequest "width",pau.Fields("upload".Width
pau_saveWidth = "width"
SetUploadFormRequest "height",pau.Fields("upload".Height
pau_saveHeight = "height"
end if
</font id=code></pre id=code>

So this stuff must go after :
<pre id=code><font face=courier size=2 id=code>
Wend
Set sip1 = Nothing
</font id=code></pre id=code>

And everything will be OK.
This bug is considered for fixing for next update.
Please, excuse us for any incovenience.

Regards,


M.Zografski

-----------------------------------
DMXZone.com Support Team
-----------------------------------
Replied 01 Aug 2008 03:02:43
01 Aug 2008 03:02:43 phillip moraghan replied:
Thanks for this. Good to see you guys helping out so quickly!

Just one thing...this works now...kind of. Unfortunately it stores the dimensions of the original file. If this is to work properly, it really should store the values of the resized image.
Replied 01 Aug 2008 10:36:41
01 Aug 2008 10:36:41 Miroslav Zografski replied:
Hi Phillip,

I'll paste here the code of my page that inserts the resized image width and height into MySQL database correctly:

<pre id=code><font face=courier size=2 id=code>
&lt;%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%&gt;
&lt;!--#include file="Connections/test.asp" --&gt;
&lt;!--#include file="ScriptLibrary/incSIP2Class.asp" --&gt;
&lt;!--#include file="ScriptLibrary/incPU3Class.asp" --&gt;
&lt;!--#include file="ScriptLibrary/incPU3Utils.asp" --&gt;
&lt;%
'*** Pure ASP File Upload 3.0.10
' Process form form1
Dim pau, DMX_uploadAction, UploadRequest, UploadQueryString, pau_thePath, pau_nameConflict, pau_saveWidth, pau_saveHeight
Set pau = new PureUpload
pau.ScriptLibrary = "ScriptLibrary"
pau.ConflictHandling = "over"
pau.StoreType = "file"
pau.UploadFolder = """uploads"""
Dim uploadupload
set uploadupload = pau.AddField("upload"
uploadupload.UploadFolder = ""
pau.ProcessUpload
pau.SaveAll
%&gt;
&lt;%
' Smart Image Processor 2.5.0
Dim sip1
Set sip1 = New ImageProcessor
sip1.ScriptFolder = "ScriptLibrary"
sip1.Component = "Auto"
sip1.Source = "upload"
sip1.UploadFields = ""
sip1.GetFiles
While sip1.HasFiles
sip1.LoadFromSource
sip1.Resize 200, 200, true
sip1.Overwrite = true
sip1.SaveJPEG 80
sip1.MoveNext
Wend
Set sip1 = Nothing
if pau.Done then
SetUploadFormRequest "width",pau.Fields("upload".Width
pau_saveWidth = "width"
SetUploadFormRequest "height",pau.Fields("upload".Height
pau_saveHeight = "height"
end if
%&gt;
&lt;%
Dim MM_editAction
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME")
If (UploadQueryString &lt;&gt; "" Then
MM_editAction = MM_editAction & "?" & Server.HTMLEncode(UploadQueryString)
End If
' boolean to abort record edit
Dim MM_abortEdit
MM_abortEdit = false
%&gt;
&lt;%
' IIf implementation
Function MM_IIf(condition, ifTrue, ifFalse)
If condition = "" Then
MM_IIf = ifFalse
Else
MM_IIf = ifTrue
End If
End Function
%&gt;
&lt;%
If (CStr(UploadFormRequest("MM_insert") = "form1" Then
If (Not MM_abortEdit) Then
' execute the insert
Dim MM_editCmd
Set MM_editCmd = Server.CreateObject ("ADODB.Command"
MM_editCmd.ActiveConnection = MM_test_STRING
MM_editCmd.CommandText = "INSERT INTO Table1 (name, width, height) VALUES (?, ?, ?)"
MM_editCmd.Prepared = true
Response.Write(" Value for width to be inserted: " & UploadFormRequest("width")
Response.Write(" px, Value for height to be inserted: " & UploadFormRequest("height" & " px"
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param1", 202, 1, 50, UploadFormRequest("upload") '' adVarWChar
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param2", 5, 1, -1, MM_IIF(UploadFormRequest("width", UploadFormRequest("width", null)) '' adDouble
MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param3", 5, 1, -1, MM_IIF(UploadFormRequest("height", UploadFormRequest("height", null)) '' adDouble
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
End If
End If
%&gt;
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
&lt;html xmlns="www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
&lt;title&gt;Untitled Document&lt;/title&gt;
&lt;script src="Scripts/AC_RunActiveContent.js" type="text/javascript"&gt;&lt;/script&gt;
&lt;script type="text/javascript"&gt;&lt;%=pau.generateScriptCode()%&gt;&lt;/script&gt;
&lt;script src="ScriptLibrary/incPU3.js" type="text/javascript"&gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;form style="width: 50%" ACTION="&lt;%=MM_editAction%&gt;" METHOD="POST" enctype="multipart/form-data" name="form1" id="form1" onSubmit="&lt;%=pau.submitCode()%&gt;;return document.MM_returnValue"&gt;
&lt;p&gt;
&lt;input name="upload" type="file" id="upload" onChange="&lt;%= pau.Fields("".Value %&gt;" /&gt;
&lt;input type="submit" name="2" id="2" value="Submit" /&gt;
&lt;input name="width" type="hidden" id="width" value="&lt;%= pau.Fields("upload".Width %&gt;" /&gt;
&lt;input name="height" type="hidden" id="height" value="&lt;%= pau.Fields("upload".Height %&gt;" /&gt;
&lt;input type="hidden" name="MM_insert" value="form1" /&gt;
&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;fieldset style="width: 50%"&gt;
&lt;p&gt; &lt;%= pau.Fields("upload".FileName %&gt; Dimentions : &lt;%= pau.Fields("upload".Width %&gt; px by
&lt;%= pau.Fields("upload".Height %&gt; px&lt;/p&gt;
&lt;p&gt;&lt;%= pau.Fields("upload".FileName %&gt; Size : &lt;%= pau.Fields("upload".Size %&gt; Kb&lt;/p&gt;
&lt;p&gt;Uploaded to : ../&lt;%= pau.Fields("upload".UploadFolder %&gt; &lt;/p&gt;
&lt;/fieldset&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;
</font id=code></pre id=code>

Regards,

M.Zografski

-----------------------------------
DMXZone.com Support Team
-----------------------------------
Replied 04 Aug 2008 04:28:34
04 Aug 2008 04:28:34 CK Nyak replied:
Thanks, I wrote a work around for it but tomorrow I will review and see how it works.

Thanks Again.
Replied 27 Jan 2009 12:38:11
27 Jan 2009 12:38:11 phillip moraghan replied:
Is this fix being implemented. It is very annoying having to make these code changes. All I want to do is store the resized image dimensions, not the original.
Replied 19 Feb 2009 12:13:12
19 Feb 2009 12:13:12 Miroslav Zografski replied:
Hi Phillip,

Unfortunately that fix is not yet implemented.

Regards,
Replied 19 Feb 2009 23:07:14
19 Feb 2009 23:07:14 phillip moraghan replied:
It's a pretty major issue. Almost worthy of a dot release.

Reply to this topic