I think the simplest way is to create a database table on X.com to track all images your user store on Y.com, for example:
+----------+-------------------------+
| user_id | image_path |
+----------+-------------------------+
| 0 | /images/image_xxxxx.jpg |
| 0 | /images/image_xxxxx.jpg |
| 2 | /images/image_xxxxx.jpg |
| 2 | /images/image_xxxxx.jpg |
| 3 | /images/image_xxxxx.jpg |
+----------+-------------------------+
and then serve on X.com all your images redirecting the browser to Y.com
X.com:
<img src="Y.com/images/image.xxxxx.jpg" />