Don’t use imagecreatefromstring

Jan
31
2012

If you’re looking to create a jpg file from raw image data, like from an email attachment, don’t use imagecreatefromstring(); because it strips almost all the header data including a ton of exif info off the file. Simply do this

Voila you got yourself an image file with all the meta info including the much needed orientation exif value!