Reading/writing image exif data with PHP

Choices of reading: built-in exif_read_data (PHP 4.2+) or exifReader class from http://www.sanisoft.com/phpexifrw/

For writing, there is no built-in function. You'll need to use a custom solution.

You can also use ImageMagick for reading and writing exif data. For CentOS installation instructions go to codercake.net: Installing ImageMagick 6.6.9-7 and imagick 3.0.1 for PHP on CentOS 5.5 64 bit.

yum install ImageMagick ImageMagick-devel
yum remove ImageMagick
yum install libtool-ltdl libtool-ltdl-devel freetype freetype-devel fontconfig-devel

wget http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
rpm -Uvh epel-release-5-4.noarch.rpm

yum --enablerepo=epel install jasper jasper-libs jasper-devel

wget http://www.imagemagick.org/download/linux/CentOS/x86_64/ImageMagick-6.6.7-9.x86_64.rpm
wget http://www.imagemagick.org/download/linux/CentOS/x86_64/ImageMagick-devel-6.6.7-9.x86_64.rpm
rpm -Uvh ImageMagick-6.6.7-9.x86_64.rpm
rpm -Uvh ImageMagick-devel-6.6.7-9.x86_64.rpm

pecl install imagick

echo 'extension=imagick.so' > /etc/php.d/imagick.ini
service httpd restart

The PHP interface to ImageMagick is at http://www.php.net/manual/en/class.imagick.php and exif extraction example is at http://valokuva.org/?p=18

The interesting functions are imagick::getImageProperties and imagick::setImageProperty.

Image to check:


Comments

by PHP programming on 03 May 2011
I expect more than that from your blog so keep it up and great blog comparing to other one's you will give me the procedure for that because i was waiting for the replay I like to subscribe this blog. Thanks
Reply
Add your comment