November Happy Hour will be moved to Thursday December 5th.

Imageresizing problem with jpeg

Vote:
 

is anyone having trouble to get .jpeg files to scale? png, gif and jpg are working as intended but jpeg wont scale. I'm running episerver 7.5 and have added the fix (thank you for that Martin http://world.episerver.com/Code/Martin-Pickering/ImageResizingNet-integration-for-CMS75/) I noticed that the regex was missing jpeg, so I added that and was hoping that it would fix my problem. Sadly, it didn't. So I'm wondering if I've missed something here, which I'm pretty sure I have :)

#82189
Mar 07, 2014 7:40
Vote:
 

Sorry that you are having problems with this.

Personally I have never been interested in anything other than jpg|gif|png and is why the code I wrote only took account of those file extensions.

ImageResizing.Net registers itself to work by default with jpeg extensions when used with file and VPP plugins, so I assume that it does work with jpegs. Again no personal experience of this.

By changing the two regex expressions in the EPiServerBlobReaderPlugin class to incorporate the jpeg file extension, I would have thought that you should have been golden. Apparently not.

Try eliminating the blobreader code from the rest of the environment in an attempt to isolate the problem some more, for example, upload a jpeg file to the episerver site's published location, e.g. c:\episerver\alloy\wwwroot\testImage.jpeg, and make requests to resize that image. If those request fail then you'll know that the issue is down to something other than the blobreader. If those requests work then it is probably something to do with the blobreader that the Author overlooked. In which case, if I were you I'd get in touch with the Author and ask for your money back :), or drop me a line.

#82235
Mar 07, 2014 19:52
Vote:
 

Hi Martin

 

Thank you for your response and I Want my money back! :D I tried as you said with a jpeg in the root and it worked perfectly. So something is fishy with the blobreader. adding jpeg to the regex doesn't help as I said earlier and I have no idea what could be causing this. 

#82287
Mar 10, 2014 10:44
Vote:
 

@Rizo

Right, I have tried to perform resizing of jpeg images to see if I could repeat your observations.

First of all I made a quick change to the two private Regex members of the EPiServerBlobReaderPlugin like so...

        private readonly Regex _isAssetImageRegex =
            new Regex(@".*/(?:globalassets|contentassets|siteassets)/.*\.(?:jpeg|jpg|gif|png)",
                RegexOptions.CultureInvariant | RegexOptions.IgnoreCase | RegexOptions.Singleline |
                RegexOptions.Compiled);

        private readonly Regex _isEditModeImageUrlRegex =
            new Regex(@"(.*/(?:globalassets|contentassets|siteassets)/.*\.(?:jpeg|jpg|gif|png)),{2}\d+",
                RegexOptions.CultureInvariant | RegexOptions.IgnoreCase | RegexOptions.Singleline |
                RegexOptions.Compiled);

    

Note that I have added "jpeg" as a searched for file extension to both of the Regex expressions. This is so that requests for jpegs stored in the EPiServer Blob Store via either Visitor or Edit Mode will be recognised and intercepted. Any intercepted Requests are then handled by the EPiServerBlobReaderPlugin and will have any associated ImageResizing.Net commands applied to the Response.

Recompiled my solution and gave it a go.

I uploaded a jpeg to my media store. I dragged (and dropped) the published jpeg onto an XHtmlString Property of any old Page Instance and then added a resize command onto the image's URL, e.g. &width=100. Finally, I remembered to go the Appearance Tab of the Insert/Edit Image TinyMCE tool and blank out the two dimensions boxes before publishing my new Page version.

All fine in both Edit Mode and Visitor Mode, jpeg image resized as per expectation.

So please check again the changes you have made and how you are using them. Thanks

PS: Please also note that I have not found the need to resort to the suggested change by @olov (on http://world.episerver.com/Code/Martin-Pickering/ImageResizingNet-integration-for-CMS75/) to the PostAuthorizeRequestStarted method in order for Resizing in Edit Mode to work. I don't yet know why there have been issues experienced (or what they were) when in Edit Mode or what the suggested change is suppossed to accomplish (as at best it appears to be neutral to me).

 

#82392
Mar 11, 2014 14:53
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.