user2450099
user2450099

Reputation: 385

PHP - changing metadata of a JPEG

Or other image file. Can this be done in a (fairly) simple way using PHP?

I'm coding a website that will allow users to upload photos, but I know JPEGs are notorious for their metadata and ideally I'd like to strip all images uploaded of metadata, either by removal or replacement with junk text.

Upvotes: 2

Views: 1235

Answers (3)

keithhatfield
keithhatfield

Reputation: 3273

If you're just looking to strip most of the exif data quickly and easily without using a library to specifically write it, you can 'resave' the image using gd:

$file = 'myjpg.jpg';
$im = imagecreatefromjpeg($file);
imagejpeg($im, 'myjpg2.jpg');

Maybe not the best/prettiest solution, but it accomplishes what you want without adding additional libraries.

Upvotes: 2

This_is_me
This_is_me

Reputation: 918

i use getID3 library for this. it makes it quite easy

http://getid3.sourceforge.net/

it works with al lot of file extentions for a demo click here: demo

Upvotes: -1

Rob
Rob

Reputation: 11798

Take a look at this extension for PHP: http://lsolesen.github.io/pel/

Upvotes: 1

Related Questions