|
|
|
Joined: 3/30/2010
Posts: 67
|
|
|
hello,
i use
bitmap = new Bitmap(image, newWidth, newHeight);
when i get image from fileUpload and want to save it in another size, and it all working fine, but it cause high CPU Usage.
i use tool windbg and i saw the stackrace :
OS Thread Id: 0x2b90 (32)
Child SP IP Call Site
0b44e1b4 7451e319 [InlinedCallFrame: 0b44e1b4]
0b44e1b0 7a1efc48 *** WARNING: Unable to verify checksum for C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Drawing\72269ea7cc6281139e4d155e7c57dc67\System.Drawing.ni.dll
DomainNeutralILStubClass.IL_STUB_PInvoke(System.Runtime.InteropServices.HandleRef, System.Runtime.InteropServices.HandleRef, Int32, Int32, Int32, Int32)
0b44e1b4 7a1e9e69 [InlinedCallFrame: 0b44e1b4] System.Drawing.SafeNativeMethods+Gdip.GdipDrawImageRectI(System.Runtime.InteropServices.HandleRef, System.Runtime.InteropServices.HandleRef, Int32, Int32, Int32, Int32)
0b44e200 7a1e9e69 System.Drawing.Graphics.DrawImage(System.Drawing.Image, Int32, Int32, Int32, Int32)
0b44e22c 7a1e84d1 System.Drawing.Bitmap..ctor(System.Drawing.Image, Int32, Int32)
0b44e274 0adf31e8 CI.Modules.Products.EditProduct.scaleImageAndSave(Byte[], System.String)
0b44e340 0adf2e9d CI.Modules.Products.EditProduct.scaleImageAndUploadFileToServer(System.Web.UI.WebControls.FileUpload, System.String, System.String)
0b44e3d0 0adf048d CI.Modules.Products.EditProduct.cmdUpdate_Click(System.Object, System.EventArgs)
0b44e5c0 0ae1ffb8 CI.Modules.CI_basic.Button.cmdButton_Click(System.Object, System.EventArgs)
0b44e5e0 658f6b7b *** WARNING: Unable to verify checksum for C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Web\273389de0b6e286cb2bdc83ecb428704\System.Web.ni.dll
System.Web.UI.WebControls.Button.OnClick(System.EventArgs)
0b44e5f4 64fda6f8 System.Web.UI.WebControls.Button.RaisePostBackEvent(System.String)
0b44e608 64fda67b System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(System.String)
0b44e610 64fb71ce System.Web.UI.Page.RaisePostBackEvent(System.Web.UI.IPostBackEventHandler, System.String)
0b44e61c 64fb88a4 System.Web.UI.Page.RaisePostBackEvent(System.Collections.Specialized.NameValueCollection)
0b44e630 64fb932d System.Web.UI.Page.ProcessRequestMain(Boolean, Boolean)
0b44e7ec 64fb8ab5 System.Web.UI.Page.ProcessRequest(Boolean, Boolean)
0b44e820 64fb89e9 System.Web.UI.Page.ProcessRequest()
0b44e854 64fb8916 System.Web.UI.Page.ProcessRequestWithNoAssert(System.Web.HttpContext)
0b44e860 64fb777b System.Web.UI.Page.ProcessRequest(System.Web.HttpContext)
0b44e874 0a818ea6 ASP.default_aspx.ProcessRequest(System.Web.HttpContext)
0b44e884 64fbda36 System.Web.HttpApplication+CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
0b44e8c8 64f98a26 System.Web.HttpApplication.ExecuteStep(IExecutionStep, Boolean ByRef)
0b44e90c 64fabed2 System.Web.HttpApplication+PipelineStepManager.ResumeSteps(System.Exception)
0b44e990 64f98ce0 System.Web.HttpApplication.BeginProcessRequestNotification(System.Web.HttpContext, System.AsyncCallback)
0b44e9a8 64f94dbb System.Web.HttpRuntime.ProcessRequestNotificationPrivate(System.Web.Hosting.IIS7WorkerRequest, System.Web.HttpContext)
0b44e9f8 64f9ac73 System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr, IntPtr, IntPtr, Int32)
0b44e9fc 64f9aa4f [InlinedCallFrame: 0b44e9fc]
0b44ea90 64f9aa4f System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr, IntPtr, IntPtr, Int32)
0b44ef68 00caab72 [InlinedCallFrame: 0b44ef68]
0b44ef64 650103f5 DomainNeutralILStubClass.IL_STUB_PInvoke(IntPtr, System.Web.RequestNotificationStatus ByRef)
0b44ef68 64f9add0 [InlinedCallFrame: 0b44ef68] System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr, System.Web.RequestNotificationStatus ByRef)
0b44ef9c 64f9add0 System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr, IntPtr, IntPtr, Int32)
0b44efa0 64f9aa4f [InlinedCallFrame: 0b44efa0]
0b44f034 64f9aa4f System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr, IntPtr, IntPtr, Int32)
0b44f10c 00caab72 [ContextTransitionFrame: 0b44f10c]
how can i resolve it ?
i try to use Grapics.DrawImage instaed but the same problem occured.
thank you,
adi damty
|
|
|
|
| |
|
|
|
www.ventrian.com Joined: 1/1/2003
Posts: 230
|
|
|
I assume you're using DotNetNuke 6.2+
If so, the DNN core has an image utility inbuilt to it.
In DotNetNuke.Common.Utilities.ImageUtils, there is a method with a signature of:
public static string CreateImage(string sFile, int intHeight, int intWidth)
So, you should be able to just call:
ImageUtils.CreateImage(myPath, 500, 500)
To resize a file to 500 width + 500 height.
|
|
|
|
| |
|
|
Joined: 3/30/2010
Posts: 67
|
|
|
hello Scott,
i am using DNN 06.02.03,
i try what you said and the problem still occured ( attach below the error in windbg ), and this function also damge the file quality when resize the image ( equal to the other way that the quliaty wasn't damage ). why this i get this error in windbg ? when i run visual studio 2010 in debug mode it all works fine without any error...
thank you,
adi damty
OS Thread Id: 0x221c (43)
Child SP IP Call Site
0811e6d0 7451e319 [InlinedCallFrame: 0811e6d0]
0811e6cc 7a1ed0ff *** WARNING: Unable to verify checksum for C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Drawing\72269ea7cc6281139e4d155e7c57dc67\System.Drawing.ni.dll
DomainNeutralILStubClass.IL_STUB_PInvoke(System.Runtime.InteropServices.HandleRef)
0811e6d0 7a29bb0d [InlinedCallFrame: 0811e6d0] System.Drawing.SafeNativeMethods+Gdip.GdipImageForceValidation(System.Runtime.InteropServices.HandleRef)
0811e708 7a29bb0d System.Drawing.Bitmap..ctor(System.String)
0811e720 07f50264 DotNetNuke.Common.Utilities.ImageUtils.CreateImage(System.String, Int32, Int32)
0811e910 05edf31c CI.Modules.Products.EditProduct.scaleImageAndSave(Byte[], System.String, System.String)
0811e9c4 05edf058 CI.Modules.Products.EditProduct.scaleImageAndUploadFileToServer(System.Web.UI.WebControls.FileUpload, System.String, System.String)
0811ea80 05eddd73 CI.Modules.Products.EditProduct.cmdUpdate_Click(System.Object, System.EventArgs)
0811ec70 0dcae2c0 CI.Modules.CI_basic.Button.cmdButton_Click(System.Object, System.EventArgs)
0811ec90 658f6b7b *** WARNING: Unable to verify checksum for C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Web\273389de0b6e286cb2bdc83ecb428704\System.Web.ni.dll
System.Web.UI.WebControls.Button.OnClick(System.EventArgs)
0811eca4 64fda6f8 System.Web.UI.WebControls.Button.RaisePostBackEvent(System.String)
0811ecb8 64fda67b System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(System.String)
0811ecc0 64fb71ce System.Web.UI.Page.RaisePostBackEvent(System.Web.UI.IPostBackEventHandler, System.String)
0811eccc 64fb88a4 System.Web.UI.Page.RaisePostBackEvent(System.Collections.Specialized.NameValueCollection)
0811ece0 64fb932d System.Web.UI.Page.ProcessRequestMain(Boolean, Boolean)
0811ee9c 64fb8ab5 System.Web.UI.Page.ProcessRequest(Boolean, Boolean)
0811eed0 64fb89e9 System.Web.UI.Page.ProcessRequest()
0811ef04 64fb8916 System.Web.UI.Page.ProcessRequestWithNoAssert(System.Web.HttpContext)
0811ef10 64fb777b System.Web.UI.Page.ProcessRequest(System.Web.HttpContext)
0811ef24 0cd33ec6 ASP.default_aspx.ProcessRequest(System.Web.HttpContext)
0811ef34 64fbda36 System.Web.HttpApplication+CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
0811ef78 64f98a26 System.Web.HttpApplication.ExecuteStep(IExecutionStep, Boolean ByRef)
0811efbc 64fabed2 System.Web.HttpApplication+PipelineStepManager.ResumeSteps(System.Exception)
0811f040 64f98ce0 System.Web.HttpApplication.BeginProcessRequestNotification(System.Web.HttpContext, System.AsyncCallback)
0811f058 64f94dbb System.Web.HttpRuntime.ProcessRequestNotificationPrivate(System.Web.Hosting.IIS7WorkerRequest, System.Web.HttpContext)
0811f0a8 64f9ac73 System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr, IntPtr, IntPtr, Int32)
0811f0ac 64f9aa4f [InlinedCallFrame: 0811f0ac]
0811f140 64f9aa4f System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr, IntPtr, IntPtr, Int32)
0811f618 00ddab72 [InlinedCallFrame: 0811f618]
0811f614 650103f5 DomainNeutralILStubClass.IL_STUB_PInvoke(IntPtr, System.Web.RequestNotificationStatus ByRef)
0811f618 64f9add0 [InlinedCallFrame: 0811f618] System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr, System.Web.RequestNotificationStatus ByRef)
0811f64c 64f9add0 System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr, IntPtr, IntPtr, Int32)
0811f650 64f9aa4f [InlinedCallFrame: 0811f650]
0811f6e4 64f9aa4f System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr, IntPtr, IntPtr, Int32)
0811f7bc 00ddab72 [ContextTransitionFrame: 0811f7bc]
|
|
|
|
| |
|
|
Joined: 3/30/2010
Posts: 67
|
|
|
hello,
anyone has suggestions ?
thank you,
adi damty
|
|
|
|
| |
|
|
|
www.ventrian.com Joined: 1/1/2003
Posts: 230
|
|
|
A few things to try:
1.) post the full code for your codebehind.
2.) try a different image
|
|
|
|
| |