Support => cpg1.3.x Support => Older/other versions => cpg1.3 Miscellaneous => Topic started by: ericsj on November 29, 2004, 08:12:44 am

Title: Display Date Taken under Thumbnail
Post by: ericsj on November 29, 2004, 08:12:44 am
Searched the boards -- found several requests for this with no replies or solutions.

By default, # of views is displayed on the thumbnail page.  What's the easiest way to change this to the date taken (from EXIF), or at least *add* this data alongside # of views.

Even a direction to the right area of code would be helpful, if not an answer.

Thanks in advance,
Title: Re: Display Date Taken under Thumbnail
Post by: kegobeer on November 30, 2004, 02:33:37 am
This doesn't seem to be a feature request, it reads more like you want this ability now.  Moved to the appropriate board.
Title: Figured out a way to display EXIF dates below thumbs.
Post by: ericsj on December 01, 2004, 06:52:21 pm
I came up with a solution that works for me, and so I'll present it as an option for the many seeking to display the EXIF date below the thumbnail.

I have the "Sort by EXIF" mod applied, and it works great.  I noticed that when you run the mod, it extracts the EXIF date to the variable $pdate, and proceeds to write it to the database for each photo's "ptime".  I noticed that it also converts this date to a human-readable format to display as text on the "results" page that you see after running the function.  That variable is called $newdate.

Well, showing the date below the thumbnails was more important to me than showing a title (I don't use the title field at present anyway).  So I just altered the script to write the date to the 'title' field.

In util.php:

Code: [Select]
$query = "UPDATE $picturetbl SET ptime='$pdate' WHERE pid='$pid' ";
I added:
Code: [Select]
$query = "UPDATE $picturetbl SET title='$newdate' WHERE pid='$pid' ";

A few lines above that, it defines the date format for $newdate.  I altered this a little bit to be what I wanted:

Code: [Select]
$newdate = date('D, M jS Y \&\n\b\s\p\; g:i a', $pdate);
I have attached a screenshot crop of how it looks now.  Works great if you value the date display over photos having a user-defined title.  Hopefully someday a feature will be implemented into CPG so that a date display and title display could co-exist, but for now this is how I'm getting by.   ;)

Comments, please!  I know next to nothing about PHP, SQL, etc.  Is this an OK way of going about this?


[attachment deleted by admin]
Title: Re: Removing Page Header from displayimage.php pages?? Help!
Post by: Casper on December 01, 2004, 07:18:49 pm
Very good, but you've attached this to the wrong thread.  I'll move it to your other thread.
Title: Re: Display Date Taken under Thumbnail
Post by: ericsj on December 01, 2004, 09:07:21 pm
Thanks Casper... got my windows mixed up there.

Title: Re: Display Date Taken under Thumbnail
Post by: vrviji on January 10, 2005, 12:27:09 pm
I would like to display the EXIF date instead of the Upload date also. So,
Would I be able to do this fix ( as described above ) , if I have not applied the Sort by EXIF Mod ?

That is, would the field $pdate be available and contain the EXIF Picture Taken date.

And instead of replacing the title field, I would replace the Upload Date field with this date. THen, all the thumbnails would have the Date Taken displayed under the picture, instead of the date on which the picture was uploaded.


Viji Rajasundram