how much memory is left on the phone?
when you did these factory resets, did you use the phone WITHOUT ADDING the gifs and older photos to your new phone's memory? if you did not add these images and the phone still froze, then its a phone issue.
but if you kept loading these images after each reset and it kept freezing, seems like these images may be the culprit.
so since you are willing to do factory resets, do another one, sign in with your gmail account and do not load the photos and test the device then.