Author Topic: Show time to upload  (Read 10564 times)

0 Members and 1 Guest are viewing this topic.

Offline edonai

  • Newbie
  • *
  • Posts: 32
    • View Profile
Show time to upload
« on: August 18, 2009, 05:42:47 AM »
Hello to all.
I would like to know how to display the time of upload in the MOD "new_images" ?
For example "5 hours ago" or "two days ago" etc..... ?

Thanks for your help

Edonai

Offline GaYan

  • Sr. Member
  • ****
  • Posts: 301
  • ♫ | G2 | ♫
    • View Profile
    • Ziramagic
Re: Show time to upload
« Reply #1 on: August 18, 2009, 02:10:04 PM »
That Great  :) Even Im Waiting for a mod Like this  :!: :wink:
I'm Back :)

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Administrator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Show time to upload
« Reply #2 on: August 18, 2009, 03:06:36 PM »
where do you want this to be showed? on each image instead of full date?
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Benny Change

  • Addicted member
  • ******
  • Posts: 1.788
  • #WWG1WGA
    • View Profile
    • Qlobal-Change
Re: Show time to upload
« Reply #3 on: August 18, 2009, 03:10:59 PM »
Nice. ^^
I Waiting for this mod too!
Beste Gre
Benny

Offline Hagen-Roderich

  • Full Member
  • ***
  • Posts: 127
    • View Profile
    • Hof Jokers
Re: Show time to upload
« Reply #4 on: August 18, 2009, 03:26:05 PM »
where do you want this to be showed? on each image instead of full date?

On Signature MOD (http://www.4homepages.de/forum/index.php?topic=6755.msg139651#msg139651) please.

Offline edonai

  • Newbie
  • *
  • Posts: 32
    • View Profile
Re: Show time to upload
« Reply #5 on: August 18, 2009, 04:57:59 PM »
where do you want this to be showed? on each image instead of full date?

Yes V@no, like this : http://www.theanimegallery.com/ (it's a beautiful site by IGC !)

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Administrator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Show time to upload
« Reply #6 on: August 19, 2009, 02:46:58 AM »
In includes/functions.php find:
  $timezone_offset = (defined("TIME_OFFSET")) ? TIME_OFFSET 0;

Insert above:
  if (isset($user_info['date_alt']) && $user_info['date_alt'])
  {
    return 
format_date_alt($format$timestamp);
  }


Above ?> insert:
function format_date_alt($format$timestamp//based on duration function from http://snipplr.com/view.php?codeview&id=2711
{
  global 
$user_info$lang;

  
$t time() - ($timestamp + (3600 * (defined("TIME_OFFSET") ? TIME_OFFSET 0)));
  
$vals = array('y' => (int) ($t 86400 365),
                
'o' => (int) ($t 86400 30),
                
'w' => (int) ($t 86400 7),
                
'd' => $t 86400 7,
                
'h' => $t 3600 24,
                
'm' => $t 60 60,
                
's' => $t 60);
  
$ret = array(); 
  
$added false
  foreach (
$vals as $k => $v)
  { 
    if (
$v || $added)
    {
      
$added true;
      if (
$v 1)
      {
        
$k $lang['date_alt'][$k][1];
      }
      else
      {
        
$k $lang['date_alt'][$k][0];
      }
      
$ret[] = $v " " $k;
    }
  }

  return 
join(' '$ret); 



In index.php find:
  $bgcounter 0;

Insert below:
  $user_info['date_alt'] = 1;


Find:
unset($new_images);

Insert below:
unset($user_info['date_alt']);


In lang/<your language>/main.php above ?> insert:
$lang['date_alt'] = array(
  
'y' => array("year""years"),
  
'o' => array("month""months"),
  
'w' => array("week""weeks"),
  
'd' => array("day""days"),
  
'h' => array("hour""hours"),
  
'm' => array("minute""minutes"),
  
's' => array("second""seconds"),
);
« Last Edit: August 19, 2009, 02:42:42 PM by V@no »
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline edonai

  • Newbie
  • *
  • Posts: 32
    • View Profile
Re: Show time to upload
« Reply #7 on: August 19, 2009, 12:49:14 PM »
Thank you, you are super!
i follow your instruction, but the display is incorrect :



I call the function with the following tag: {image_date}

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Administrator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Show time to upload
« Reply #8 on: August 19, 2009, 02:43:23 PM »
ops, sorry, missed one step for main.php file..added in the instructions above.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline edonai

  • Newbie
  • *
  • Posts: 32
    • View Profile
Re: Show time to upload
« Reply #9 on: August 19, 2009, 07:59:09 PM »
Big thanks V@no, you're great!  :P

Offline Benny Change

  • Addicted member
  • ******
  • Posts: 1.788
  • #WWG1WGA
    • View Profile
    • Qlobal-Change
Re: Show time to upload
« Reply #10 on: August 19, 2009, 08:28:53 PM »
Beste Gre
Benny

 

Post your comments here