PDA

View Full Version : shooting_time option to Photo Page Settings


ipru
16th of March 2007 (Fri), 07:31
Please add shooting_time option to Photo Page Settings.

kolohe
16th of March 2007 (Fri), 10:18
I agree that this would be a nice addition. It is possible to change the shooting_date option to a shooting_datetime option with a few small code hacks. If you're interested, I can post the mods here.

ipru
26th of March 2007 (Mon), 02:34
I agree that this would be a nice addition. It is possible to change the shooting_date option to a shooting_datetime option with a few small code hacks. If you're interested, I can post the mods here.

Hmmm... maybe there should be shooting_date, shooting_time and combined shooting_datetime so user can choose what to use. Please post your mods here.

kolohe
4th of April 2007 (Wed), 12:46
Sorry for the delay in getting this posted. The job thing got in the way :)

Here are the changes I made. The line numbers I reference may not be exactly correct. You will need to understand the basics of PHP and MySQL syntax to properly place the code.

In file photo.php, below line 380 is code that sets $basics_sql to a rather long SELECT statement. Below the line containing

ee_photo.ee_photo_exif_time,

add a line containing

ee_photo.ee_photo_exif_datetime,


Staying in photo.php, around line 810 you will see a comment

// SQL DATA TO VARIABLES

Below that a few lines is the statement

$shooting_date = $xyz["ee_photo_exif_date"];

Change it to

$shooting_date = $xyz["ee_photo_exif_datetime"];



In admin/EDITOR_settings_global.php:

Around line 250 is a group of statements defining the various date/time formats included with EE. Add a line along like this:

ee_option("99",$s_dateformat,"Paul's personal format");


In basecode/SCRIPT_common_functions.php:

Around line 350, you will find a switch statement that actually performs the date formatting. Add code like this:

case 99:
$date2 = strftime("%A, %B %#d, %Y, %H:%M:%S",$date);
break;

Note that the number on the case statement must match the first argument to ee_option!!! To get the exact date/time format you want, you'll need to look up the strftime PHP function. I did that in my PHP book, but there are plenty of sources on the web for that information.

Using these changes as a starting point, you could add code to allow the date, time or date/time combination. Since all I wanted was the date/time string I use (Wednesday, April 4, 2007 09:42:45), I just changed the existing display method to what I wanted it to be. I'm sure that Pekka will make this all extremely flexible (as he does SO well) at a future date.

Standard disclaimer :) : This worked for me. It may not work for you. I am not responsible if adding the above code completely trashes your EE installation, etc., etc.

Enjoy.

Paul