WP is showing wrong image dimensions

Several times over time I changed sizes of thumbnails WP generate when images are uploaded, always setting bigger size.

Recently I set Thumbnail Width 600px width and Medium size Max Width 1800px. After several hundred images uploaded I realized that I need to set smaller image sizes, I reduced Medium size from 1800px to 1500px for future uploads.

I know that already uploaded images will stay on disk in bigger resolution, and that is fine by me, I do not need to use any plugin to regenerate thumbs again.

Problem:

Word Press now shows that size for images uploaded before is also 1500px width, even real size is 1800px (for an example it shows 1500px x 1000px for image that is 1800px x 1200px).

I changed few times width of future images in Dashboard > Settings > Media and I figured out that if real dimensions of already uploaded images are bigger than what is now set in Media Settings, WP will say that width of those images is the width that is set in Media Settings, even real dimensions are bigger.

You can see screenshot example here: https://postimg.cc/fScS3WKH

This is code I use to get image and its dimensions.

$  medium_image_url = wp_get_attachment_image_src( get_post_thumbnail_id($  post->ID), 'medium'); // Featured image medium size  // To show image dimensions    echo $  medium_image_url[1]; // Show width echo $  medium_image_url[2]; // Show height 

How to get real image dimension of already uploaded images which dimensions are bigger than one now set in media settings?