"The image of his father appeared to him." With these words Chazal encapsulate where Yosef drew his strength from to overcome the temptation of the wife of Potifar. On a basic level we can understand that Yosef was simply reminded by his father's image of the values his father had taught him in his youth. Perhaps there was more than just Yaakov as an individual that strengthened Yosef and enabled him to make the correct decision in whose merit he would eventually be called Yosef Hatzadik.
Yosef had already been separated from his father for some time when the episode of Potifar's wife occurs. During this time Yosef no doubt thought much about his father; he must have replayed in his mind countless times the last moments he had spent with Yaakov. The Torah tells us explicitly where their last meeting occurred. Yaakov sent Yosef from "Emek Chevron" - the Valley of Chevron - to locate his brothers. Chazal noted the significance of Chevron, the burial place of Avraham, being the place where Yaakov and Yosef parted. Undoubtedly the image of his father standing and waving goodbye to him in the shadow of the burial place of his great-grandfather Avraham was etched in Yosef's mind. When the image of his father appeared at the moment of truth, it was not just Yaakov's face that appeared. Yaakov as the grandson of Avraham and all that was represented by that image flashed in front of Yosef's eyes.
Avraham's relationship with Hashem, which encompassed being the forefather of the nation of Hashem and being the recipient of Eretz Yisrael, would be passed on to his children. The Torah highlights that Avraham's legacy would not go to all his biological descendants,rather only to Yitzchak. זרעך אחריך״ - your descendants that follow you" would carry the legacy, from Avraham to Yitzchak and from Yitzchak to Yaakov. Chazal tell us that part of the covenant with Avraham required his descendants to marry those who would preserve that legacy. As such, great care was necessary to find the proper match for Yitzchak. The daughters of Canaan would not be able to preserve that legacy. Yitzchak had instructed Yaakov not to marry the daughter of Canaan for the same reason.
Yosef's test was specifically in this area of Kedushas Yisrael. Yosef had to choose between committing an act that would be the antithesis of bringing descendants of Avraham into this world and remaining steadfast to the legacy of his forefathers. At that moment, Yaakov's image appeared to him with the background of Chevron to remind him that he too could be a link in this holy chain. However, he could only be so if he preserved that sanctity to enable him to eventually bring his own children into this world with sanctity and purity.
Perhaps Me'oras Hamachpela served as the background for this image of Yaakov for another reason. There are two fundamentally different ways to view death. One's perception of the essence of life will impact one's thoughts about death: if life is all about physical pursuits, death is the absolute end of such an existence; however, one whose life is a spiritual one continues to live on even after his physical demise, since the spirit lives forever. Yaakov standing in front of the burial place of his grandfather symbolized the Torah's concept of life and death. Although Avraham's body was laid to rest, his soul lived on and his spiritual legacy continued to serve as an inspiration to his descendants for eternity. Yaakov had been chosen to continue this legacy. Esav lived for the physical moments, as was evident by his decision to trade the opportunity to be the first born who would continue the heritage of Avraham and Yitzchak. Because of his attitude, Esav could never carry on the spiritual traditions of his father and grandfather. It was Yaakov who dwelled in the tents of Torah who would continue this heritage.
Yosef's moment of challenge required of him to decide what his life was all about. Was life a pursuit of instant gratification and physical pleasure, or was life meant to be the opportunity to perfect oneself spiritually? To succumb to his temptation would have placed Yosef in the realm of Esav and all those who traded their spiritual treasures for a bowl of soup. It was at this moment that Yaakov appeared to him with Chevron in the background. Upon seeing this image, Yosef remembered the lessons he had learned about what life was really all about.
Yaakov's image appeared to Yosef when he needed it most. Yosef drew the strength and inspiration from the appearance of his father against the background of Chevron to retain his place as a link in the glorious chain that would become Klal Yisroel.