Skip to content

Commit

Permalink
Image attributes can also be decimals so handle that
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeavon committed May 3, 2024
1 parent 0592c86 commit 1a4da8e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Slimsy/Services/SlimsyService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -556,10 +556,10 @@ private string ConvertImgToResponsiveInternal(string html, bool generateLqip = t
NameValueCollection queryStringCollection;

int? width = null, height = null;
if (widthAttr != null && heightAttr != null && int.TryParse(widthAttr.Value, out var outWidth) && int.TryParse(heightAttr.Value, out var outHeight))
if (widthAttr != null && heightAttr != null && decimal.TryParse(widthAttr.Value, out var outWidth) && decimal.TryParse(heightAttr.Value, out var outHeight))
{
width = outWidth;
height = outHeight;
width = (int)Math.Round(outWidth);
height = (int)Math.Round(outHeight);

}
else if (hasQueryString)
Expand Down

0 comments on commit 1a4da8e

Please sign in to comment.