While resizing an image in sitecore using the ResizeProcessor based on the width parameter the height is being resized.I have set the width as 100% as background image.For this using the Sitecore Resizeprocessor the height by default scaling factor of 0.5 comes out to be 710px. I have the container for background image with dimensions having height as 570px. So by fitting the image into the container of height of 570px,the image gets stretched across the width. How to stop the image to get stretched across the width and also to have its height set as 570px?
Asked
Active
Viewed 259 times
0
-
This is a CSS issue, not Sitecore: http://stackoverflow.com/questions/11757537/css-image-size-how-to-fill-not-stretch – jammykam Oct 28 '15 at 09:43
-
I think there was a market place module which removes the height & width from images to make suit responsive designs. You can try that module. – Vikram Oct 29 '15 at 09:26
1 Answers
1
Harness the power of Sitecore and C# by deriving from the Resizeprocessor and creating your own custom Resizeprocessor. Override the Process method and essentially have it do anything you want.
1) Create a new class
public class CustomResizeProcessor : ResizeProcessor
2) Override Process method
public override void Process()
3) Replace the original processor with the new process in the pipeline in web.config
<!--<processor type="Sitecore.Pipelines.PipelineName.ResizeProcessor, Sitecore.Kernel" />-->
<processor type="Custom.Webcms.SitecoreUtil.Processors.CustomResizeProcessor, Custom.Webcms.Sitecore" />
Hope this helps.

Steven Zhao
- 101
- 7