Hi and welcome to the Community,
I see only one image here, so I’m not sure to understand what you want to achieve in fine.
May be a mock-up or adding your images (even non-working) in the PG would help.
For now, I can simply redo your current behavior (for which you say ‘it works’), easily done with just setting .top and a value. The value of ‘top’ or ‘left’ on a container is set on the container either in pixels or percentage. In any case it does not come from the size of your image. It is the image that eventually adapts to the size of the container. Let us know when you have more details and meanwhile, have a great day