ImageHelper.ResizeImage(params) rise exception

This is the place to report bugs and get support. When posting in this forum, please always provide as much detail as possible.

Please do not report problems with a custom build or custom code in this forum. If you are producing your own build from the source code and have problems or questions, ask in the developer forum, do not report it as a bug.

This is the place to report bugs and get support

When posting in this forum, please try to provide as many relevant details as possible. Particularly the following:

  • What operating system were you running when the bug appeared?
  • What database platform is your site using?
  • What version of mojoPortal are you running?
  • What version of .NET do you use?
  • What steps are necessary to reproduce the issue? Compare expected results vs actual results.
Please do not report problems with a custom build or custom code in this forum. If you are producing your own build from the source code and have problems or questions, ask in the developer forum.
This thread is closed to new posts. You must sign in to post in the forums.
2/21/2012 4:00:28 PM
Gravatar
Total Posts 4

ImageHelper.ResizeImage(params) rise exception

Hi All,

there is simple call used by me from time to time, looks like this:

ImageHelper.ResizeImage(destPath, IOHelper.GetMimeType(ext), resizeWidth, resizeHeight, WebConfigSettings.DefaultResizeBackgroundColor);

It's still OK with mojo v. 2366 but it rise exception at current 2381. I've debugged the sources a bit and it seems what the ~ symbol been added by the native code.

Pleas, let me know: is it some bug or something been changed, maybe, in communications with the filesystem etc. Thanks for your time anyway, regards, Igor.

-----------------------

[ArgumentException: The relative virtual path '~D:/work/....../web/Web/Data/Sites/1/fk_userfiles/ship1.jpg' is not allowed here.] System.Web.VirtualPath.FailIfRelativePath() +8922556 System.Web.Hosting.HostingEnvironment.MapPathActual(VirtualPath virtualPath, Boolean permitNull) +49 System.Web.Hosting.HostingEnvironment.MapPathInternal(VirtualPath virtualPath) +42 System.Web.Hosting.HostingEnvironment.MapPath(VirtualPath virtualPath) +51 System.Web.Hosting.HostingEnvironment.MapPath(String virtualPath) +19 mojoPortal.FileSystem.DiskFileSystem.MapPath(String virtualPath) in D:\work\.......\web\Web\Components\FileSystem\DiskFileSystem.cs:124 mojoPortal.FileSystem.DiskFileSystem.FileExists(String virtualPath) in D:\work\......\web\Web\Components\FileSystem\DiskFileSystem.cs:187 mojoPortal.Web.ImageHelper.ResizeImage(String imageFilePath, String mimeType, Int32 maxWidth, Int32 maxHeight, Boolean allowEnlargement, Color backgroundColor) in D:\work\...\web\Web\Components\ImageHelper.cs:335 mojoPortal.Web.ImageHelper.ResizeImage(String imageFilePath, String mimeType, Int32 maxWidth, Int32 maxHeight, Color backgroundColor) in D:\work\.......\web\Web\Components\ImageHelper.cs:310 skipped

2/21/2012 4:07:48 PM
Gravatar
Total Posts 18439

Re: ImageHelper.ResizeImage(params) rise exception

Hi Igor,

I think a while back this was moved from mojoPortal.Business.WebHelpers project into mojoPortal.Web. This was a needed change when we abstracted the file system to be able to plug in Azure Blob Storage.

So you may just need to add a reference to mojoPortal.Web it is mojoPortal.Web.ImageHelper

Hope that helps,

Joe

2/21/2012 4:37:23 PM
Gravatar
Total Posts 4

Re: ImageHelper.ResizeImage(params) rise exception

Hi Joe, thanks a lot for reply!

Well, I've tryed but result was the same: exception claimed to the "~".

My new call: mojoPortal.Web.ImageHelper.ResizeImage(params);

With bests!, Igor.

2/21/2012 4:44:28 PM
Gravatar
Total Posts 18439

Re: ImageHelper.ResizeImage(params) rise exception

Hi Igor,

If you were previously passing in a file system path ie using Server.MapPath before passing in the path, you need to change it to pass in a virtual path like ~/path/to/your/file.png or /path/to/your/file.png may also work, ie I'm not sure the ~ is required, but it can't be an already resolved path for the disk file system, otherwise it would not work for other file systems with different storage. The default filesystem plugin is the disk file system, but it will do the .MapPath internally.

Hope that helps,

Joe

2/21/2012 5:25:55 PM
Gravatar
Total Posts 4

Re: ImageHelper.ResizeImage(params) rise exception

Joe, thanks a lot!

Solved.

---- With bests!, Igor.

You must sign in to post in the forums. This thread is closed to new posts.