in reply to Make scalar act like file path
I believe the simpliest solution would be to just write the contents to a temporary file and then include the image like your normally do.
Could use File::Temp.