|
#1
|
|||
|
|||
|
Setting time automatically
Currently I am
1) Uploading a lot of photos 2) Setting the time on each one manually so they appear at a rate of one a day What I would like to do is 1) Upload a lot of photos, and have Pixelpost automatically set the datetime as (24 hours after the most recent addition) so that the 1 photo a day system will work without me manually having to change the datetime Also, even if you set the datetime into the future, it's still currently possible to see the photos by altering the url - ie changing showimage=12 to showimage=112 will show picture 112, even if it shouldn't be appearing for two weeks. Is there any way to fix this? Many thanks in advance. Roddy |
|
#2
|
|||
|
|||
|
The posting bit is not so easy, but fixing the ability to see future posts is. Just change the line in index.php from
Code:
$query = mysql_query("select * from ".$pixelpost_db_prefix."pixelpost where (id='".$_GET['showimage']."')");
to
$query = mysql_query("select * from ".$pixelpost_db_prefix."pixelpost where (id='".$_GET['showimage']."' and datetime<='$cdate')");
|
|
#3
|
|||
|
|||
|
That's great, thanks.
I've now manually set two months worth of pictures. However, I think the solution to automatically setting the time is to go into the 'add folder' file under add ons, and where it currently inserts the date, tell it instead to select the date from the latest entry, add 24hours to it, and then insert THAT date. However, I probably won't get round to trying it for two months . . . |
|
#4
|
|||
|
|||
|
I tend to post in advance too, so I may get around to doing this too. It is something that annoys me, so...
You should also check your archive pages. I had to make a similar fix to the view archive by category query because I was seeing future entries in categories. I am not sure if that bug is in the default install though because I have installed the multiple categories hack. |
|
#5
|
|||
|
|||
|
I had a bunch of photos to upload tonight, so I made the change you suggested. Here is how I did it;
Code:
<div id='content'>
Set a date and time when you want the image to appear on your blog. Leave as is if it should be published immediately.<p />
Year-month-day&nbsp;&nbsp;&nbsp;&nbsp; hour-minute<br />
Code:
<div id='content'>
<input type='checkbox' name='autodate' value='1' checked>Set the date to 1 day after the last posted image, or<br /><br />
Set a date and time when you want the image to appear on your blog. Leave as is if it should be published immediately.<p />
Year-month-day&nbsp;&nbsp;&nbsp;&nbsp; hour-minute<br />
Code:
if( $_POST['autodate'] == 1 ) {
$query = mysql_query("SELECT datetime + INTERVAL 1 DAY FROM ".$pixelpost_db_prefix."pixelpost ORDER BY datetime DESC LIMIT 1");
$row = mysql_fetch_row($query);
if( $row ) $datetime = $row[0];
}
Code:
$datetime =
$_POST['post_year']."-".
$_POST['post_month']."-".
$_POST['post_day']." ".
$_POST['post_hour'].":".
$_POST['post_minute'].":00";
|
|
#6
|
|||
|
|||
|
That looks great. I'll be using it with the copy folder add on, but it shouldn't be too hard to adapt. And thanks for the tip about the archives.
Roddy |
|
#7
|
|||
|
|||
|
Ok, I finally got around to automating this.
in addons/copy_folder.php find // insert post in mysql look a few lines ABOVE this for a reference to $datetime = . . . remove that line (or more wisely comment it out) then one line below "$filenumber++;" add $datetime = date("Y-m-d H:i:00", mktime(date("H"), date("i"), $filenumber*INTERVAL, date("m"), date("d"), date("Y"))); this will add a certain amount of time to the time stamp for each picture. You can set this by changing INTERVAL to the number of SECONDS you want between each picture. For example $datetime = date("Y-m-d H:i:00", mktime(date("H"), date("i"), $filenumber*3600, date("m"), date("d"), date("Y"))); will put one hour between each pic. Hope this is useful to someone. Roddy |
|
#8
|
|||
|
|||
|
Roddy.
Looks like a great solution. I tried the add / delete lines and things got a bit screwy. Could you post the entire code? Thanks
__________________
www.nauglevision.com/pix |
|
#9
|
|||
|
|||
|
Apologies for the delay, I'm only an occassional visitor (actually came back this time to get my own code, as I overwrote it when upgrading
ops: )Here's the code you need, with the changes highlighted in red. You need to comment out one line, and insert one other. The number 52100 in the inserted line gives me a gap of around 13 hours between posts - adjust as you will. These changes need to be made in addons/copy_folder.php // $datetime = gmdate("YmdHis",time()+(3600 * $tz)) .$secondcount; $secondcount++; // prepare the file $oldfile = $file; $newfile = "{$datetime}_$file"; $newpath = "$upload_dir$newfile"; $file = "$folder$file"; if(copy($file,$newpath)) { $filenumber++; $datetime = date("Y-m-d H:i:00", mktime(date("H"), date("i"), $filenumber*52100, date("m"), date("d"), date("Y"))); // insert post in mysql - supports new multi-category table in ver 1.4 $query = "insert into ".$pixelpost_db_prefix."pixelpost(id,datetime,head line,body,image,category) VALUES('','$datetime','$oldfile','','$newfile','$c ategory')"; $result = mysql_query($query) || die("Error: ".mysql_error()); |
| Post Reply |
| Thread Tools | |
|
|