Satellite

Satellite 1.1

No permission to download

AndyB

Well-known member
Creating a satellite image with a Cron Job:

I suggest creating a Cron job on your server so the image will load faster. Also many satellite images are very large and you might need to crop the image. All this can be done using the example PHP as shown here:

PHP:
<?php

// define satelliteUrl
$satelliteUrl = 'http://goes.gsfc.nasa.gov/goescolor/goeswest/pacific2/color_lrg/latest.jpg';

// define satellitePath
$satellitePath = '/home/southbay/www/misc/satellite.jpg';

// define latestTextPath
$latestTextPath = '/home/southbay/www/weather/california/images/latest.txt';

// get timestamp
$timestamp = file_get_contents($latestTextPath);

// get data
$data = file_get_contents($satelliteUrl);

// save satellite.jpg, this file will be modified
file_put_contents($satellitePath, $data);

// reduce image size from 3600x3000
exec("/usr/bin/convert -quiet $satellitePath -crop 900x625+750+450 $satellitePath");

// convert date format	
$date = date(' F d, Y g:i A ', $timestamp);

// add date to image
exec("/usr/bin/convert $satellitePath -font courier_new.ttf -pointsize 12 -fill black -undercolor white \
-gravity northwest -annotate +2+2 '$date' $satellitePath");
 
Last edited:
Top Bottom