If both domains on same server then you can try defining UPLOAD_ROOT for domain2.com to to point to same root that domain1.com uses.
Learn full path for image folder on domain1.com, say for example it is
/home/user/domains/domain1.com/public_html/user-content/uploads. then change
define(‘UPLOAD_ROOT’, FROG_ROOT . ‘/user-content/uploads’);
on domain2.com to
Also if you are using exactly same site and want it to be used with domain1.com and domain2.com then create domain1.com regularly, then add domain2.com as alias for domain1.com. And you will not have to change anything. Both domains will work and user will stay on same domain accessing same website.