This sentence might be considered funny or ironic for various reasons, depending on the context. One interpretation is that it's a play on the idea of a "magic trick." Typically, magic tricks are illusions or sleight of hand that defy reality in some way. This sentence suggests that there's a trick involved in making a cheeseburger appear from a seemingly unrelated photo, whereas in reality, there's no magic involved in creating an actual cheeseburger. It's an unexpected twist on the usual premise of a magic trick, which can make it hilarious.
Secondly, the humor and irony might derive from the absurdity and randomness of the chosen object - a cheeseburger. The reader may wonder why exactly a cheeseburger should appear in the photo, rather than any other object. It's a nonsensical choice, which forms the basis of absurd humor. That people would spend time staring at a picture, hoping that a cheeseburger would miraculously appear, adds to the absurdity, making it funnier.
Thirdly, the humor could also arise from the anticipation and the subsequent letdown. The sentence sets the audience up with the suggestion of a magic trick, creating excitement and suspense. When it leads to an ordinary and mundane result - a cheeseburger - the anticlimax might evoke laughter because it's contrary to expectations. This ironic twist, moving from the extraordinary (magic) to the completely ordinary (a cheeseburger), establishes a comedic effect.
Furthermore, this sentence is an example of visual humor known as "forced perspective" or "optical illusion" comedy. The humor is derived from the idea that a person's gaze could physically transform an image if stared at long enough – like those 3D Magic Eye images where an image pops out after long enough focusing. In this case, though, instead of a hidden 3D object, it's just a cheeseburger.
The unintentional humor might also arise from the misuse of the term "magic trick". Traditionally, magic is thought of as a skill or power to influence course of events by using mysterious or supernatural forces. Here, the "magical" appearance of a cheeseburger from a picture after prolonged staring is presented as a magic trick, making it a funny misuse of the term.
Lastly, the instruction "IF YOU LOOK AT THE PHOTO LONG ENOUGH" conveys the sense that you have to put significant effort and time to visualize the cheeseburger. This creation of an expectation that a cheeseburger will materialize invokes humor, especially when the viewer realizes they have been absurdly staring at some completely irrelevant image, trying to visualize a cheeseburger. The dramatic difference between the high expectations set and the ultimate realization can be quite ironic and funny. MAGIC TRICK IF YOU LOOK AT THE PHOTO LONG ENOUGH A CHEESE BURGER APPEARS