After some interesting discussion inside the topic "Which IDE and Debugger to run zenphoto?" I created this topic because it will focused on Exif.
@Trisweb* Do you have some design/architecture advices?
* Additional Fields inside MySQL/image Table...do you mean Tags? (Metadata like
Familie, Holiday, Work etc.?)
@Thinkdreams* Exifer 1.5 is able to handle Nikon and Casio Images.
* When we put Exif Information inside the MySQL/image Table wouldn't we create
redundant information. For sorting the date info it make sense...
@all* every help is welcome
Comments
This is basically going to be a function that class-image.php uses to get EXIF information. So we need a couple things...
1) A function that takes an image as input and outputs some kind of set of EXIF data for it (an array, object, whatever).
2) Methods for getting that data into predefined database fields for the image. (Me)
3) Methods for checking the filemtime of the image, and if it has been updated, refresh the image EXIF data back into the cache. (Me again)
4) Then, if all looks up-to-date, use the database info instead of re-processing the EXIF.
Re: Additional fields/redundant information: These are NOT tags, I'm talking about duplicating (caching) the EXIF data in the database. Parsing a file for its EXIF data is an intensive process. We can do benchmarks to find out just how intensive it is, but I know it's not simple. Reading data from a database, on the other hand, is very fast, plus we already do a query for each image so adding an additional 10, 20 or even 30 fields won't slow anything down beyond the already existing query overhead. The EXIF will only need to be read from the image once per image update, which is good.
If you mean that some data will always be the same, like camera model, then I agree completely, we could use an ID instead into an exif data table. But for most of the exif data, it varies a lot, so it won't be very necessary. We'll look at the data and decide later if we need to alter the schema.
So let's get that EXIF library reading image data first, make a new method in the Image class to read it, process it, and store it by using $this->set('variablename')*, and don't worry about the database caching just yet. I'll take care of that.
* $this->set('variablename') with a variablename that's not in the database was just implemented, it's in SVN but not in 1.0.8. We'll get there...
* Performance is a good issue...you are right.
* How to store Exif inside MySQL, as one (Multiline-) String or dedicade 5-30 fields? I
ask, because it seems to me that different brand (Nikon, Casio, Sony) has sometimes
different Exif Tags. Hm, dedicaded fields could be easier to handle.
* Lets start with "exif-functions.php"?
More in the evening...
Tris in a previous post suggested storing one EXIF field per column, so I think dedicated fields would probably be the best thing.
* I will try to use Exifer 1.5 to get the five important fields (date, time, Camera)
and put them into the images table fields like date, time etc..
This functionality will be inside a new exif-functions.php.
* For more integration I would need a deeper understanding of Zenphoto Architecture (yes I
know the old joke "the source code is the docu").
* In the long run, it would be nice to use the Exif date information to show the photo
distribution over the last years in a timeline. But this is a differnt story
http://www.thinkdreams.com/devzen/index.php?album=vermont&image=hi_bunnies.jpg
(Aren't the bunnies cute?)
Oh, sorry. Try looking at the raw EXIF data below.
Another example is:
http://www.thinkdreams.com/devzen/index.php?album=njsummer&image=IMG_2129.JPG
which has better camera info.
Looks like everything is already in an array.
Implemented by:
In the image.php
`
<?php include ('zen/exif.php'); ?>
<?php<br />
$path = "../" . getFullImageURL();
$verbose = 0;
$result = read_exif_data_raw($path,$verbose);
echo " ";
?>
`
And in the zen directory I placed the makers dir and the exif.php from the Exifixer library.
The code above is basically taken from the index.php file supplied with the distribution.
Really rough, but a start.
date and time,
camera make and model (looks like two fields)
fstops,
exposure time,
aperture?,
flash (yes or no),
focal length,
orientation (important for rotation)
Looks like the raw data returned pretty much takes care of these, and these should be common among most, if not all maker data with a few exceptions.
I'm not fantastic on arrays and data processing. To be really honest, I stink. How are you at arrays Stef? Since there potentially is a large amount of data, we need to find the commonly used data, and maybe just grab those rather than the whole raw set of data?
Am I even making sense? It's been a looooong week.
I guess you'd just want to find where the data resides in the array, and just reference it and assign it to some variables... something like...
`$result = read_exif_data_raw($path,$verbose);
if ($result['ValidEXIFData'] == 1) {
$aperture = $result['SubIFD']['ApertureValue'];
$exptime = $result['SubIFD']['ExposureTime'];
...
}`
Then you have your EXIF data :-)
* Shit happens...my Linux hard disk has a defect MBR. This is the second time that a
Maxtor HD become damaged in 4 weeks.
* I will be back as soon as possible.
@thinkdreams
* My first thoughts with "bunnies" are...of course rapids.
Question:
* After a new installation did it make sense to use LAMPP in place of seperate Apache2,
PHP 5 and MySQL?
If you're using Debian/Ubuntu, just use apt-get, it integrates everything correctly and works great. On gentoo obviously use emerge. Not sure what distro you're using.
No worries about delays
I know that this statement will sound pretty opinionated (I apologize), but
speaking from experience (as a network admin with lots of years of tech support experience), never, never, never buy maxtor again. they have the worst industry record for failures and errors. stick with seagate or western digital, generally speaking they have decent track records. all hard drives fail, but maxtor seems to suck more than all the others.
We had a mission critical NAS appliance at work by maxtor and it was awful. it crashed all the time, and for a business file server system, that isn't good. we ended up going back to an HP Proliant rack server after 1.5 years using it, and we replaced the unit's drives at least 3 times during that time.
(Maxtor no longer makes NAS appliances BTW)
And what the heck do rapids have to do with cute little bunnies?
I am also curious as to what the heck rapids have to do with bunnies. :-)
I recognized, that the PHP-Function exif_read_data() [http://de2.php.net/manual/de/function.exif-read-data.php] not always do, what they have 2 do (PHP Package must be Compiled with --enable-exif to work). And now i have found your thread that you still work on the exif function for ZP. Nice ^^
*Thread Merged*
sry 4 my shitty ^^ english
Tom
I'm back...or should I say my LINIX PC is back.
VMWare:
* After this bad experience I thinking about using a VMWare Image with all necessary
things inside (Zenphoto source, LINUX, Eclipse PHP IDE, Apache2, MySQL etc.). It will
be only for testing and codeing.
Exif:
* I will create a Exif function (ExifValue(TagName)?) that is able to read ExifTags and
returns the value of the ExifTag.
* Does it make sense for you?
So, we can either rewrite the raw tag function, or write a new one that does the same thing (I'm thinking a new function that stores into variables rather than displays would probably be best)
All I really need to do is write the function that grabs the tags from the image and drops them into variables as you outlined above. Then I can hand it off to you to look over. Hopefully within the next week or so, earlier if I can free up some time.
http://www.thinkdreams.com/devzen/index.php?album=njsummer&image=IMG_2120.JPG
If you note, it displays the image information before the print_r statement (which prints out all the raw data). Thus I have most of the common EXIF information now stored as variables, which you should be able to take a then cache in the DB using the functions you're writing. Once we have the data in the DB, then we can do fancier stuff like automatic image rotates if it's out of rotation, etc.
I've sent this to you via email Tristan. See what you can make of it, and let me know how you want me to proceed further. I think I've covered most of the major variables. A lot of the maker data for specific camera models is pretty much redundant or unnecessary IMHO.
Looks great...how to get it? I'm still engage with Exif theme, but I struggle now a little
bit with the programming structure. BTW, how could a good zenphoto documentation look
like? UML ?
Modified Exifixer libs and added function to assign exif tags to variables.
Modified image.php to add display of raw EXIF data and variable data.
If you send your email address to me at craig@thinkdreams.com I'll be happy to send the changed files to you. I'm using the effervescence theme for testing, but you should be able to drop the code into any theme.
The docs are very much in the beginning stages, so don't expect a large amount of user information until more contributions are made to it. Feel free to contribute though!
Please send me the Exif Code...if there is a problem with my email I will send it again.
Thanks in advance
@trisweb,thinkdream
Docu: How to create Pictures/Grafik for the Zenphoto Wiki? Is there a prefered open source
tool?
Looking through the EXIF code sometime this week... never enough time...
Thanks for your code. It works. I thinking about how to put this information inside MySQL or should we
wait for Tristan?
What about your theme "thinkdream"? Does it make sense to upgrade them to exifer?
@trisweb, thinkdreams
Is there a way with svn to merge the different code variants together? Do we have different code
branches?
And take your time. Have to pay the bills somehow. I might be in and out the next two weeks anyway, as it's Linux training time for my company...
I changed your theme "thinkdream" to use Exifer libs. Coming from J2EE I'm still surprised
how easy it is to integrate new functionality in PHP (but still missing a PHP debugger,
sigh)
@trisweb
This weekend I will try to write the Exif information to MySQL. Tris to you have some recommendation for me where to put the code? It is just another PHP programming test
step for me...