bad meme...flags are correctly placed on both caskets
https://www.military.com/flag-day/us-flag-code.html
When the flag is used to cover a casket, it should be so placed that the union is at the head and over the left shoulder. The flag should not be lowered into the grave or allowed to touch the ground.
That said, the photo is oriented to see the Q and not the flag.
So Trump was saluting the coffin from the back?
So why not rotate the camera 180 degrees? That makes both the upside-down flag and the Q go away.