Display Date Taken under Thumbnail Display Date Taken under Thumbnail
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Display Date Taken under Thumbnail

Started by ericsj, November 29, 2004, 08:12:44 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ericsj

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,
Eric

kegobeer

This doesn't seem to be a feature request, it reads more like you want this ability now.  Moved to the appropriate board.
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

ericsj

#2
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:

After:
$query = "UPDATE $picturetbl SET ptime='$pdate' WHERE pid='$pid' ";
       MYSQL_QUERY($query);

I added:
$query = "UPDATE $picturetbl SET title='$newdate' WHERE pid='$pid' ";
 MYSQL_QUERY($query);
   

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

$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?

Thanks!

[attachment deleted by admin]

Casper

Very good, but you've attached this to the wrong thread.  I'll move it to your other thread.
It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

ericsj

Thanks Casper... got my windows mixed up there.

;D

vrviji

Hi,
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.

Thanks,

Viji Rajasundram
www.sundram.org