MiamiManiac131, on August 9, 2009 - 03:22 PM, said:
Desktoptopia is installing alright but isn't changing the wallpaper. Based on some comments I've been reading, looks like the app's developer went quiet sometime last year...
Fish4Life, on August 9, 2009 - 03:35 PM, said:
Yea couldnt get it to work on my mac, so I just put it on my windows netbook
I am still looking for a Mac option. So far, no luck. I think it could be done as a cron job. I'll play with it tonight or tomorrow and post the results and the code if it works.
Rabbethan, on August 9, 2009 - 06:37 PM, said:
Genius. Though, you should probably add a 5 min delay, since that's about what it takes for the new image to come up.
Any chance I could see the coding?
BTW, I see you're running Windows 7 as well. Ain't it grand?
I've been using it since it leaked in December and haven't turned back.Running on my desktop, laptop, and netbook and it beats the pants offanything else I've tried on those systems thus far.
Below is obviously the code. Nothing fancy, kind of sloppy. At themoment the cutoff for day/night is hardcoded at 6 am and 8 pm. I canprobably stomach the bandwidth to maybe use GD and add a time & date watermark + the Marlins logo. I guess I could just cache thatimage server-side and call it a day.
<?php
date_default_timezone_set('US/Eastern');
function image_time($time=false) {
if(!$time) $time = time()-3600; // fall a minute back
$t['t'] = $time;
$t['y'] = date('Y', $time);
$t['m'] = date('m', $time);
$t['d'] = date('d', $time);
$t['h'] = date('H', $time);
$t['i'] = sprintf("%02d",floor(date('i', $time)/15)*15);
return $t;
}
$t = image_time();
if($_GET['day'] == true) {
// only return "day" hours
if($t['h'] < 6) {
// early morning, go to previous day
$t = image_time(strtotime('yesterday 20:00'));
}
else if($t['h'] > 20) {
// late evening, go to 20:00 of current day
$t = image_time(strtotime('today 20:00'));
}
}
else if($_GET['night'] == true) {
// only return "night" hours
if($t['h'] > 6 && $t['h'] < 20) {
// day time, go to 6:00 of current day
$t = image_time(strtotime('today 06:00'));
}
}
$image_url ='http://archives.earthcam.com/archives5/ecnetwork/us/fl/miami/marlins//'.$t['y'].'/'.$t['m'].'/'.$t['d'].'/'.$t['h'].$t['i'].'.jpg';
header( 'Location: '.$image_url ) ;
?>