Honestly, I’m unsure where to start explaining this one but here goes.
I built a Umbraco project using 7.7.2 for a friend but it never went live. It sat dormant for about 2 years until he recently decided he wanted to put some effort into it and get it live. I sent it over for him to populate and I’m experiencing a very weird issue with Image Processor where after calling GetCropUrl(“alias”, “cropAlias”) it is rotating and sometimes leaving black bars .
He uploaded a tonne of images into the media section and also via the various croppers available on the different document types and although they display correctly (correct orientation) in the CMS. On the front end they are wrong.
Example in the CMS (for image cropper)
Example on the front end (for image cropper)
Example in the CMS (for media image)
Example on the front end
The code (wasnt using model builder at the time of the build) is as follows:
Cropper image code (service is IPublishedContent via a foreach)
<img class="img-responsive" src="@(service.HasValue("image") ? service.GetCropUrl("image", "768x768") : productImgPlaceholder)" alt="@service.Name" title="@service.Name">
Media Image code (pulled from an album in the media section)
var galleryAlbum = Umbraco.TypedMedia(Model.Content.GetPropertyValue<int>("galleryAlbum"));
<ul class="work-grid">
@foreach (var image in galleryAlbum.Children)
{
<li class="col-sm-3 col-md-2">
<a href="@image.Url" title="@image.Name" class="image-lightbox">
<div class="work-item-image">
<img class="img-responsive" src="@image.GetCropUrl(768,768)" alt="@image.Name" title="@image.Name">
</div>
</a>
</li>
}
</ul>
I have looked at the following things with no luck
- I have upgraded to the latest version on V7 (now running v7.15.5).
- I’ve also done some comparisons against other projects, specifically around the image processor config files (cache, processing, security)
- Installed GitHub - marcemarc/uSpinMeRightRound: Work on rotating an image in the Umbraco Media section after it has been uploaded
- Clean, rebuild and removed and restored all packages to ensure correct binaries are being used
- Deleted TEMP and Cache folders from App_Data
- (as a test) Append auto rotate which does work but leaves black bars in the portrait view
It seems that it uses a crop mode of percentage instead of crop!
I have read some posts on ‘our’ mentioning EXIF data but after removing the photo info it doesn’t make a difference.
Some of the posts on Our
- image autorotate
<<— seems very similar and is recent so im thinking has something
changed? - images uploaded with image cropper are being auto rotated
- image cropper crops but does not resize
Perhaps its something to do with the image itself which were all from iPhone. If I create an image canvas in photoshop i.e. 768x768 place the image o, save for web, and upload to Umbraco via media or crop… it displays as expected in the CMS and front end. The problem is there are hundreds of images and I wanted to avoid going through them all and editing. Also, it gives me no confidence in future uploads.
Ive built many small Umbraco sites using v8 and v7 and ive not come across this. If anyone can help me I would be really grateful.
This is a companion discussion topic for the original entry at https://our.umbraco.com/forum/103249-image-processor-rotating-images-and-leaving-black-bars