is there a way to have the size of a widget in a variable?
I would like to dynamically create this link with the actual width and height in an image-widget, so that the resulting image has the correct size.
I don’t think there is a way you can do this. You can create your own widget which has a flexible size and will spill over the container to give you want you want but that would be “ugly”.
If you scale the image proportionately, it should not matter that the container is not dynamic. Why do you want it to move?