Umbraco 12 image resize with query string on IIS problem

141 views Asked by At

In the process of upgrading my website to Umbraco 8 to 12. I used simple trick with query string to resize the image on v8, like /photo.jpg?width=100, and worked fine, locally in dev, and deployed to IIS (Win Server 2019, .NET 4.7).

Now with upgraded Umbraco 12 (8>10>12, move to .NET Core), locally it still resize (so using Kestrel & IIS Express), but after I deploy to IIS image is not resized but always displayed in the original size.

Server is still Win Server 2019, .NET Core 7 server pack installed, web site works fine just doesn't resizes images.

Looks to me that IIS is maybe serving the image directly, so Umbraco (and ImageSharp, if thats used?) are not even getting those image requests? How to resize images properly in U12, and is there any special IIS setting i have to configure? Btw, tried that url.GetCropUrl(width:100), but doesn't do anything special, just adds query string with doesn't work on IIS.

1

There are 1 answers

0
Hrvoje Hudo On BEST ANSWER

Think i found what was the problem here!

I added "Media" as a Virtual Directory in IIS (for backups and some sharing... Its Umbracos default folder for uploaded user stuff), and seems that Umbraco or ImageSharp, or even .NET Core doesn't know how to work properly with IIS Virtual Directories. Same thing works fine in .NET 4.8 and Umbraco 8.