When image in vertical position watermark (date time) not show properly ](https://i.sstatic.net/LOlcendr.png)
Question:
I am working on a modal where an image can be rotated by 90 degrees each time the user clicks a button. The issue I am facing is that when the image is rotated to 90° or 270°, part of it gets cut off, even though I have set overflow: auto on the container.
What I Expect:
The full image should always be visible inside the modal. If necessary, the modal should adjust its size dynamically. If the image is too big, scrollbars should appear instead of cutting off the image.
What Happens Instead:
At 0° and 180° rotation, the image displays correctly. At 90° and 270° rotation, parts of the image are not visible. The modal size does not properly adjust to fit the rotated image.
<div class="slideshow-container">
@if (Model.Count > 0)
{
int counter = 1;
foreach (var item in Model)
{
var imgpath = item.ImageUrl + "?var=" + DateTime.Now.Ticks;
<div class="mySlides fade">
<div class="row">
<div class="col-sm-4">
<div class="rot-icon">
<img data-id="@counter" src="@Url.Content("~/Content/images/rotation-icon.png")" class="rotation-icon" alt="" title="rotate image" style="height:32px;" >
</div>
</div>
<div class="col-sm-4 numbertext">@counter / @Model.Count</div>
<div class="col-sm-4"></div>
</div>
<div class="img-rotation">
<img id="imageToRotate-@counter" src='@imgpath' />
</div>
<input id="imagehdn-@counter" type="hidden" value="@item.ImageName" />
<input id="hdn-angle-@counter" type="hidden" value="0"/>
<input id="hdn-isRotate-@counter" type="hidden" value="0" />
@* <div class="text">@item.ImageName</div>*@
</div>
counter++;
}
}
<a class="prev" onclick="plusSlides(-1)">❮</a>
<a class="next" onclick="plusSlides(1)">❯</a>
</div>
.mySlides .text {
background: rgba(0, 0, 0, 0.2);
}
.mySlides img {
max-width: 100%;
/*max-height: 400px;*/
}
.rotate-button {
max-width: 5.5%;
margin-left: 79%;
margin-top: 5px;
cursor: pointer;
}
.img-rotation {
align-items: center;
display: block;
overflow: auto;
max-height:360px;
padding: 0 60px;
width: 100%;
}
.img-rotation img {
/*height: 220px;*/
}
$(function () {
var images = [];
var imageObj = {};
var angle = [];
for (let i = 0; i < @Model.Count; i++) {
angle.push(0);
}
$('.rotation-icon').click(function () {
$('#saveRotateImage').prop('disabled', false);
$('#saveRotateImage').addClass('toggleRotate');
const imageid = $(this).data('id');
$(`#hdn-isRotate-${imageid}`).val(1);
angle[imageid - 1] = (angle[imageid - 1] + 90) % 360;
$(`#imageToRotate-${imageid}`).css('transform', 'rotate(' + angle[imageid - 1] + 'deg)');
$(`#hdn-angle-${imageid}`).val(angle[imageid - 1]);
})`