Umbraco Image Processor not cropping images
Asked Answered
P

2

9

Having same issue as many others in regards to Umbraco ImageProcessor not cropper. I am currently using Version 7.4 but 7.3 also does not crop image at all.

I am using Azure Blob storage, with CDN have followed configuration setup to the a tee.

Full image is getting uploaded into Azure Storage via Umbraco Back Office but have tried various formatted URL requests to pull and crop image but none have worked whether JPG or PNG file. No cropping occurs at all, always full image is returned.

Using fiddler, I can see that the request is going to Azure Blob to retrieve image, but no matter the crop size, always returns full image size.

http://localhost:10876/media/1022/grower.jpg?center=0.70666666666666667,0.505&mode=crop&width=100&height=50&rnd=130950810990000000

Packages Config ...

<package id="ImageProcessor" version="2.3.1.0" targetFramework="net452" />
  <package id="ImageProcessor.Web" version="4.4.1.0" targetFramework="net452" />
<package id="ImageProcessor.Web.Config" version="2.2.4.0" targetFramework="net452" />
 <package id="ImageProcessor.Web.Plugins.AzureBlobCache" version="1.0.5.0" targetFramework="net452" />
<package id="UmbracoFileSystemProviders.Azure" version="0.5.0-beta" targetFramework="net452" />

Web Config ...

  <modules runAllManagedModulesForAllRequests="true">
  <remove name="WebDAVModule" />
  <remove name="UrlRewriteModule" />
  <add name="UrlRewriteModule" type="UrlRewritingNet.Web.UrlRewriteModule, UrlRewritingNet.UrlRewriter" />
  <remove name="UmbracoModule" />
  <add name="UmbracoModule" type="Umbraco.Web.UmbracoModule,umbraco" />
  <remove name="ImageProcessorModule" />
  <add name="ImageProcessorModule" type="ImageProcessor.Web.HttpModules.ImageProcessingModule, ImageProcessor.Web" />
  <remove name="ScriptModule" />
  <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
  <remove name="ClientDependencyModule" />
  <add name="ClientDependencyModule" type="ClientDependency.Core.Module.ClientDependencyModule, ClientDependency.Core" />
  <!-- Needed for login/membership to work on homepage (as per https://mcmap.net/q/352953/-httpcontext-current-session-is-null-when-routing-requests) -->
  <remove name="FormsAuthentication" />
  <add name="FormsAuthentication" type="System.Web.Security.FormsAuthenticationModule" />
</modules>

 <httpModules>
  <add name="UrlRewriteModule" type="UrlRewritingNet.Web.UrlRewriteModule, UrlRewritingNet.UrlRewriter" />
  <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
  <add name="UmbracoModule" type="Umbraco.Web.UmbracoModule,umbraco" />
  <add name="ImageProcessorModule" type="ImageProcessor.Web.HttpModules.ImageProcessingModule, ImageProcessor.Web" />
  <add name="ClientDependencyModule" type="ClientDependency.Core.Module.ClientDependencyModule, ClientDependency.Core" />
</httpModules>

enter image description here

Polypetalous answered 20/12, 2015 at 23:11 Comment(5)
First thing to check is are there any errors logged in the Log File?Ruin
Thank you for your reply. I should have noted in my question as I had checked for errors in the log files. No errors. Is there a recommended approach to stepping through the image processor logic or other ways to determine that it's even running.Polypetalous
There is an extremely long thread on this here: our.umbraco.org/projects/backoffice-extensions/… hopefully that might help?Holdup
Thanks for the link Tim but according to the comments on that thread I have installed and setup my configurations correctly and still no cropping is happening. The images are saving and flowing to and from Blob storage perfectly fine, the caching to CDN also working well. Security configuration is working for I wasn't able to retrieve initially until I added proper white list. I don't even know if I am running through Image Processor Module/Handler. The web.config is setup correctly so I assume I am. Is there any quick test I can run to know for sure?Polypetalous
I think I see why it's not working, or at least I think I see. I added a screen shot from visual studio to question which shows the method GetImageServiceForRequest which although has a Remote Image Service in the Services collection, does not return any service. I am not 100% certain, but I suspect this should return the service however it does not. The following http request was issued localhost:2371/media/1037/…Polypetalous
P
2

The issue I was having was due to a miss-understanding on how to setup the CloudImageService within the security.config file. As mentioned I found when I stepped through the code, that although I had remote image service configured, it was not using it. The key was the prefix attribute within CloudImageService must be set to Media/ so that it aligns to the image URL path startswith .. http://localhost:1234/media/image.png... Once I had that setup correctly I am now able to see changes when I request different width/height etc. That only took me a week to resolve.

Polypetalous answered 28/12, 2015 at 22:51 Comment(1)
Thank you for this; I didn't know if you meant that Media/ needed to be case sensitive (I'm still unsure if that is the case) - but I had /media instead of media/ which was the breaking problem in the endBelenbelesprit
H
0

I had a similar issue, however none of the solutions I read online worked, or my config was already set as suggested, and I manually checked all dll versions and all were fine.

What finally resolved the issue for me is I changed the .NET Version from 4.5.2 to 4.6 This essentially broke my build, and the project would not work, so I reverted back to 4.5.2, the project built and ran again, and the cropping now worked!

I suspect the .NET versions are immaterial, but the act of changing versions flushed out the error.

Hominoid answered 28/6, 2018 at 7:27 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.