Many times you’ll want to remove the meta data on user uploaded images to your website. The meta data automatically saved to the images can contain GPS coordinates, names, locations, camera, and many other pieces of private information you don’t want to post on the internet. Removing EXIF data is simple with gmagick library in PHP. You can also use the more popular Imagick library. Imagick tends to be a slower at more operations than Gmagick and largely the same methods and properties.
Reads in image path, converts to jpg and removes meta data.
$imageFilePath = '/var/www/html/website.com/picture.jpg'; $i = new Gmagick(); $i->readImage($imageFilePath); $i->setImageFormat('JPG'); $i->stripImage(); $i->profileImage('*', null); $i->writeImage($imageFilePath); $i->destroy();