Member
Member
tepbd59   2005-09-20, 09:37
#1

I'm trying to get Exif support going, where can I send my contributions? It works so far but it's not pretty... if anybody is interested look at http://www.zareff.it/zenphoto/

Member
Member
reidab   2005-09-20, 11:36
#2

I've been working on some exif stuff myself. I'll let you know as soon as I get it online and we can compare notes.

Member
Member
tepbd59   2005-09-20, 11:43
#3

great, I have to admin that mine is kind of a hack, I had to use an external class because my ISP didn't compile exif support in php.

This is the lib I used: http://www.sanisoft.com/phpexifrw

Member
Member
ProspectiveGroove   2005-09-20, 11:59
#4

I used the following code in the image.php file of the template to show (and hide) the EXIF information:

BTW: I copied the code from another webside/forum and changed it to fit in here and to be able to turn it off and on without AJAX.

`

Member
Member
ProspectiveGroove   2005-09-20, 12:04
#5

Maybe it's an idea to be able to use the EXIF value of "ImageDescription" as automatic title of the image in the upload mode.

Member
Member
tepbd59   2005-09-20, 12:57
#6

I added the following in the template_functions.php:

require_once("exif.inc");

function getImageEXIFData() {
$er = new phpExifRW("../" . getFullImageURL());
$er->processFile();
$er->showImageInfo();
}

and then called the getImageEXIFData() from the template's image.php.

the exif.inc can be found on http://www.sanisoft.com/phpexifrw

on a side note, exif.inc has data caching on by default, I had to turn it off to get it to work on my website.

Developer
Developer
trisweb   2005-09-20, 19:25
#7

Great, I'll add this into the codebase for the next release. Thanks for doing it yourself!

Eventually I'll give you the ability to select which EXIF tags to display and all that.

Member
Member
ProspectiveGroove   2005-09-21, 14:41
#8

thanx, that would ideed be great. Also think of the "ImageDescription" as automatic title.
Keep on doing the good work!

PS: also tried gallery2 yesterday, but that wasn't that intuitive

Developer
Developer
trisweb   2005-09-21, 17:31
#9

Sadly, I laugh at gallery2. They spent three years and did XP (extreme programming) and forgot why they were doing it.

It has its place though. If you want your users to upload pics, or if you want some of the more sophisticated modules, then it's a good thing to have.

Member
Member
dryan   2005-11-20, 18:43
#10

i got a fairly simple list of exif data working for my gallery. it shows the camera i used, aperture, iso, shutter speed, focal length and date/time taken. i added this function to template-functions.php:
`

function printExifData() {

global $_zp_current_image;

$crntimg = $_zp_current_image->getFullImage();

$HTTP_HOST = getenv('HTTP_HOST'); / domain name /

$current_image = "http://$HTTP_HOST$crntimg";

$exif = read_exif_data($current_image);

while(list($k,$v)=each($exif)) {

if($k=="DateTimeTaken") { echo "Taken: $v
n"; }

if($k=="Make") { echo "Camera: "; if($v!="Canon") { echo "$v ";} }

if($k=="Model") { echo "$v
n"; }

if($k=="ExposureTime") { $exposure = $v;

                        if($exposure != "")

                        {

                        $exposure2 = split("/",$exposure);

                        if(count($exposure2) == 2)

                        {

                        $exposure = round($exposure2[0]/$exposure2[1],2);

                        if(&#36;exposure < 1) &#36;exposure = '1/'.round(&#36;exposure2[1]/&#36;exposure2[0],0);

                        }

                        &#36;exposure = "&#36;lang_exposure &#36;exposure";

                        }

                        echo "Shutter Speed: &#36;exposure sec

n"; }

if(&#36;k=="FNumber") { &#36;fstop = &#36;v;

                        if(&#36;fstop != "")

                        {

                        &#36;fstop = split("/",&#36;fstop);

                        if(count(&#36;fstop) == 2) &#36;fstop = round(&#36;fstop[0]/&#36;fstop[1],2);

                        &#36;focal = "&#36;lang_focal &#36;fstop";

                        }

                        echo "Aperture: f/&#36;fstop

n"; }

if(&#36;k=="ISOSpeedRatings") { echo "ISO Speed: &#36;v
n"; }

if(&#36;k=="FocalLength") { &#36;focal = &#36;v;

                        if(&#36;focal != "")

                        {

                        &#36;focal = split("/",&#36;focal);

                        if(count(&#36;focal) == 2) &#36;focal = round(&#36;focal[0]/&#36;focal[1],2);

                        &#36;focal = "&#36;lang_focal &#36;focal mm";

                        }

                        echo "Focal Length: &#36;focal

n"; }

}

}

`

then i can call `` in my templates to display it. hope this helps out.

Member
Member
dryan   2005-11-20, 20:22
#11

sorry to repost so soon. i change the code a bit to clean up the date formatting.

`function printExifData() {

global &#36;_zp_current_image;

&#36;crntimg = &#36;_zp_current_image->getFullImage();

&#36;HTTP_HOST = getenv('HTTP_HOST'); / domain name /

&#36;current_image = "http://&#36;HTTP_HOST&#36;crntimg";

&#36;exif = read_exif_data(&#36;current_image);

while(list(&#36;k,&#36;v)=each(&#36;exif)) {

if(&#36;k=="DateTimeOriginal") { &#36;datetime = &#36;v;

                        list(&#36;fulldate, &#36;fulltime) = explode(' ', &#36;datetime, 2);

                        list(&#36;year, &#36;monthnum, &#36;day) = explode(':', &#36;fulldate, 3);

                        list(&#36;hour, &#36;minute, &#36;second) = explode(':', &#36;fulltime, 3);

                        &#36;num[0] = "/01/";

                        &#36;num[1] = "/02/";

                        &#36;num[2] = "/03/";

                        &#36;num[3] = "/04/";

                        &#36;num[4] = "/05/";

                        &#36;num[5] = "/06/";

                        &#36;num[6] = "/07/";

                        &#36;num[7] = "/08/";

                        &#36;num[8] = "/09/";

                        &#36;num[9] = "/10/";

                        &#36;num[10] = "/11/";

                        &#36;num[11] = "/12/";

                        &#36;alpha[0] = "January";

                        &#36;alpha[1] = "February";

                        &#36;alpha[2] = "March";

                        &#36;alpha[3] = "April";

                        &#36;alpha[4] = "May";

                        &#36;alpha[5] = "June";

                        &#36;alpha[6] = "July";

                        &#36;alpha[7] = "August";

                        &#36;alpha[8] = "September";

                        &#36;alpha[9] = "October";

                        &#36;alpha[10] = "November";

                        &#36;alpha[11] = "December";

                        &#36;month = preg_replace(&#36;num, &#36;alpha, &#36;monthnum);

                        if (&#36;hour >=13) {

                            &#36;cleanhour = &#36;hour -12; }

                        echo "Taken: &#36;day &#36;month &#36;year at &#36;cleanhour:&#36;minute "; if (&#36;hour >=13) { echo "PM"; } else { echo "AM"; } echo "

\n"; }

if(&#36;k=="Make") { echo "Camera: "; if(&#36;v!="Canon") { echo "&#36;v ";} }

if(&#36;k=="Model") { echo "&#36;v
\n"; }

if(&#36;k=="ExposureTime") { &#36;exposure = &#36;v;

                        if(&#36;exposure != "")

                        {

                        &#36;exposure2 = split("/",&#36;exposure);

                        if(count(&#36;exposure2) == 2)

                        {

                        &#36;exposure = round(&#36;exposure2[0]/&#36;exposure2[1],2);

                        if(&#36;exposure < 1) &#36;exposure = '1/'.round(&#36;exposure2[1]/&#36;exposure2[0],0);

                        }

                        &#36;exposure = "&#36;lang_exposure &#36;exposure";

                        }

                        echo "Shutter Speed: &#36;exposure sec

\n"; }

if(&#36;k=="FNumber") { &#36;fstop = &#36;v;

                        if(&#36;fstop != "")

                        {

                        &#36;fstop = split("/",&#36;fstop);

                        if(count(&#36;fstop) == 2) &#36;fstop = round(&#36;fstop[0]/&#36;fstop[1],2);

                        &#36;focal = "&#36;lang_focal &#36;fstop";

                        }

                        echo "Aperture: f/&#36;fstop

\n"; }

if(&#36;k=="ISOSpeedRatings") { echo "ISO Speed: &#36;v
\n"; }

if(&#36;k=="FocalLength") { &#36;focal = &#36;v;

                        if(&#36;focal != "")

                        {

                        &#36;focal = split("/",&#36;focal);

                        if(count(&#36;focal) == 2) &#36;focal = round(&#36;focal[0]/&#36;focal[1],2);

                        &#36;focal = "&#36;lang_focal &#36;focal mm";

                        }

                        echo "Focal Length: &#36;focal

\n"; }

}

}`

Member
Member
kaline   2006-01-12, 22:49
#12

So when will the exif stuff be part of the release? I'm looking forward to that...

Member
Member
aitf311   2006-01-13, 03:16
#13

Are you guys able to put the exif stuff into the database, so sorting by picture date can be applied?

Member
Member
thatlittleguy   2006-01-13, 22:58
#14

Dryan, thanks a lot for the EXIF functions. For some reason all of the times in the AM do not contain an hour value. All those in the PM work fine. For example it will show 4:25 p.m. but 10:23 a.m. will display as :23 a.m.

Any ideas? Thank you.

Member
Member
thatlittleguy   2006-01-14, 22:41
#15

Just solved my own problem. In the GET EXIF function listed above (the most recent cleaned up version) there is a slight problem with the &#36;hour to &#36;cleanhour conversion.

To fix
Go down to line 44 and look for

`if (&#36;hour >=13) {

&#36;cleanhour = &#36;hour -12; }`

after this statement you need to tack on the phrase

`else {

&#36;cleanhour = &#36;hour;

}`

Hence, the final phrase should read

`if (&#36;hour >=13) {

&#36;cleanhour = &#36;hour -12;

} else {

&#36;cleanhour = &#36;hour;

}`

Overall though, great work dryan. This is a really useful function. Thanks.

Member
Member
webdev   2006-02-22, 15:49
#16

thnx for the posts on this topic, as my IIS host does not allow the php exif dll to be activated (ggrr) I found that the solution with the exif.inc works however this seems to terribly slow down the load preformance. So I found the next solution that works for me under apache and IIS which reads the xmp data from photoshop within the image and since I edit every image for me this is not a problem now it runs fast ! it might work for you too..

http://www.photography-on-the.net/ee/beta/cs_xmp_to_exif.php

only one problem that is it does show f.i. the F number as F 40/10 instead of F4.0 ;(

for the url path part I used
&#36;xmp_parsed = ee_extract_exif_from_pscs_xmp ("../" . getFullImageURL() . "",1);

Member
Member
webdev   2006-02-27, 22:22
#17

well I got it to work (divide the F num) thnx to dryan's code mentioned above and a php function from php.net which strips the tags from the xmp data output ;
&#36;strvalue = preg_replace ("@]*>*@", "", &#36;value);

so the full code for getting the xmp date is as follow;

`

`

I hope this will help ppl who are stuck on IIS

Member
Member
austinjreid   2006-03-02, 16:15
#18

thankyou to dryan, i used parts of your example code to get the date and cam model on my image pages. http://austinandteresa.co.uk/gallery

Just a thought if exif data is going to be inserted into the db so that we can sort etc on it. If this will be on upload then a function should be added to the admin section to do this for a) existing images and b) ftp'd images

  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.