IT Community - Software Programming, Web Development and Technical Support

Exif in php

This is a discussion on Exif in php within the PHP Programming forums, part of the Web Development category; Hi, Can any one tell me use of Exif functions in php?...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > PHP Programming

Register FAQ Members List Calendar Mark Forums Read

Reply
 
Thread Tools Display Modes
  #1  
Old 03-14-2008, 01:05 AM
Kamalakannan Kamalakannan is offline
D-Web Analyst
 
Join Date: May 2007
Posts: 299
Kamalakannan is on a distinguished road
Default Exif in php

Hi,

Can any one tell me use of Exif functions in php?
__________________
Thanks & Regards,
R.Kamalakannan.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2  
Old 03-14-2008, 01:13 AM
Jeyaseelansarc Jeyaseelansarc is offline
D-Web Genius
 
Join Date: Mar 2007
Location: Chennai
Posts: 1,165
Jeyaseelansarc is on a distinguished road
Send a message via AIM to Jeyaseelansarc
Default Re: Exif in php

Hi Kamal,
With the exif extension you are able to work with image meta data. For example, you may use exif functions to read meta data of pictures taken from digital cameras by working with information stored in the headers of the JPEG and TIFF images.
__________________
With,
J. Jeyaseelan

Everything Possible
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3  
Old 03-14-2008, 01:23 AM
Kamalakannan Kamalakannan is offline
D-Web Analyst
 
Join Date: May 2007
Posts: 299
Kamalakannan is on a distinguished road
Default Re: Exif in php

Hi,
Thanks. It is very interesting to know more on this exif function.
I have one small query here
do we need to enable anything in the php.ini?
__________________
Thanks & Regards,
R.Kamalakannan.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4  
Old 03-14-2008, 01:26 AM
Jeyaseelansarc Jeyaseelansarc is offline
D-Web Genius
 
Join Date: Mar 2007
Location: Chennai
Posts: 1,165
Jeyaseelansarc is on a distinguished road
Send a message via AIM to Jeyaseelansarc
Default Re: Exif in php

Hi Kamal,

It seems that we have to enable it individually in php.ini

To enable exif-support configure PHP with --enable-exif

Windows users must enable both the php_mbstring.dll and php_exif.dll DLL's in php.ini. The php_mbstring.dll DLL must be loaded before the php_exif.dll DLL so adjust your php.ini accordingly.

This will hellp you
__________________
With,
J. Jeyaseelan

Everything Possible
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5  
Old 03-14-2008, 01:39 AM
Jeyaseelansarc Jeyaseelansarc is offline
D-Web Genius
 
Join Date: Mar 2007
Location: Chennai
Posts: 1,165
Jeyaseelansarc is on a distinguished road
Send a message via AIM to Jeyaseelansarc
Default Re: Exif in php

exif_imagetype
This is used to determine the type of an image and reads the first bytes of an image and checks its signature. And also it can be used to avoid calls to other exif functions with unsupported file types or in conjunction with $_SERVER['HTTP_ACCEPT'] to check whether or not the viewer is able to see a specific image in the browser.

Syntax
int exif_imagetype ( string filename )

exif_imagetype() example
PHP Code:
<?php
if (exif_imagetype('image.gif') != IMAGETYPE_GIF) {
    echo 
'The picture is not a gif';
}
?>
__________________
With,
J. Jeyaseelan

Everything Possible
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6  
Old 03-14-2008, 01:55 AM
senraj senraj is offline
D-Web Master
 
Join Date: Jul 2007
Posts: 418
senraj is on a distinguished road
Post Re: Exif in php

Hi jey,

I have one small query here.

if exif_imagetype you check it only GIF IMG.

Any possible to other image type is checking ?

for example PNG and TIFF images.

do you understand my question?
__________________
Regards,
Senraj.A

Last edited by senraj : 03-14-2008 at 02:17 AM.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7  
Old 03-14-2008, 01:58 AM
Jeyaseelansarc Jeyaseelansarc is offline
D-Web Genius
 
Join Date: Mar 2007
Location: Chennai
Posts: 1,165
Jeyaseelansarc is on a distinguished road
Send a message via AIM to Jeyaseelansarc
Default Re: Exif in php

Hi Sen,

As IMAGETYPE_GIF, we have the following constants are defined, and represent possible exif_imagetype() return values

IMAGETYPE_JPEG
IMAGETYPE_PNG
IMAGETYPE_SWF
IMAGETYPE_PSD
IMAGETYPE_BMP
IMAGETYPE_TIFF_II (intel byte order)
IMAGETYPE_TIFF_MM (motorola byte order)
IMAGETYPE_JPC
IMAGETYPE_JP2
IMAGETYPE_JPX
IMAGETYPE_JB2
IMAGETYPE_SWC
IMAGETYPE_IFF
IMAGETYPE_WBMP
IMAGETYPE_XBM

i think this will help you
__________________
With,
J. Jeyaseelan

Everything Possible
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8  
Old 03-14-2008, 02:25 AM
Jeyaseelansarc Jeyaseelansarc is offline
D-Web Genius
 
Join Date: Mar 2007
Location: Chennai
Posts: 1,165
Jeyaseelansarc is on a distinguished road
Send a message via AIM to Jeyaseelansarc
Default Re: Exif in php

exif_read_data

Reads the EXIF headers from a JPEG or TIFF image file. This way you can read meta data generated by digital cameras.

Exif headers tend to be present in JPEG/TIFF images generated by digital cameras, but unfortunately each digital camera maker has a different idea of how to actually tag their images, so you can't always rely on a specific Exif header being present.

Height and Width are computed the same way getimagesize() does so their values must not be part of any header returned. Also, html is a height/width text string to be used inside normal HTML.

Validates EXIF data tags according to the EXIF specification

Syntax

array exif_read_data ( string filename ,string sections , bool arrays , bool thumbnail )

filename
The name of the image file being read. This cannot be an URL.

sections
Is a comma separated list of sections that need to be present in file to produce a result array. If none of the requested sections could be found the return value is FALSE.

arrays
Specifies whether or not each section becomes an array. The sections COMPUTED, THUMBNAIL, and COMMENT always become arrays as they may contain values whose names conflict with other sections.

thumbnail
When set to TRUE the thumbnail itself is read. Otherwise, only the tagged data is read.

exif_read_data() example

PHP Code:
<?php
echo "test1.jpg:<br />\n";
$exif exif_read_data('tests/test1.jpg''IFD0');
echo 
$exif===false "No header data found.<br />\n" "Image contains headers<br />\n";

$exif exif_read_data('tests/test2.jpg'0true);
echo 
"test2.jpg:<br />\n";
foreach (
$exif as $key => $section) {
    foreach (
$section as $name => $val) {
        echo 
"$key.$name: $val<br />\n";
    }
}
?>
__________________
With,
J. Jeyaseelan

Everything Possible
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9  
Old 03-14-2008, 02:49 AM
Falcon Falcon is offline
D-Web Analyst
 
Join Date: Nov 2007
Location: Chennai
Posts: 289
Falcon is on a distinguished road
Default Re: Exif in php

Hi Buddies

Read and Write the Exif data

Buddies this link will help us to know read and write in Exif data

PEL: PHP Exif Library

Regards
Falcon
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10  
Old 03-14-2008, 02:52 AM
Falcon Falcon is offline
D-Web Analyst
 
Join Date: Nov 2007
Location: Chennai
Posts: 289
Falcon is on a distinguished road
Default Re: Exif in php

Hi Buddies

Here Some class file and example file to read and write in Exif data

It will help us..

Regards
Falcon
Attached Files
File Type: zip phpexifrw.zip (23.5 KB, 4 views)
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Reading and writing EXIF meta data from jpg/jpeg,tiff images oxygen C# Programming 1 02-03-2009 09:11 PM
Reading EXIF, IPTC & ICC Profile metadata from an image using MagickNet in C# letmein C# Programming 0 03-27-2008 12:42 AM
List of EXIF metadata properties item name and its proprety ID values oxygen C# Programming 1 12-24-2007 01:30 AM
Read and Write IPTC and EXIF metadata fro raw Images Balasubramanian.S C# Programming 4 08-03-2007 06:38 AM
I have a C source to write iptc and exif metadata for raw images. How to use it in C# oxygen C# Programming 0 07-21-2007 01:56 AM


All times are GMT -7. The time now is 02:23 AM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.
Our Partners
One Way Moving Companies | Stamford Dentist | Euro Millions Lottery | Home Loans| Furniture

SEO by vBSEO 3.0.0