Author Topic: Sunposa.php not working  (Read 1137 times)

0 Members and 1 Guest are viewing this topic.

Offline andro700

  • Chuck
  • Forecaster
  • *****
  • Posts: 420
    • Gobles Weather Page
Sunposa.php not working
« on: July 26, 2021, 02:43:15 PM »
I am trying to get Sunposa.php to work on my astronomy page.https://www.goblesweather.com/wxastronomy.php

Here is my settings for sunposa.php,
Code: [Select]
//Start of script
###############################################################
#Settings                                                     #
###############################################################
include ("./graphsconf.php");
$jploc = './jpgraph-4.3.0/';
include ($jploc."jpgraph-4.3.0/src/jpgraph.php");
include ($jploc."jpgraph-4.3.0/src/jpgraph_scatter.php");
include ($jploc."jpgraph-4.3.0/src/jpgraph_line.php");
include ($jploc."jpgraph-4.3.0/src/jpgraph_date.php");
$clientrawextra = get_raw("${hostloc}clientrawextra.txt");

/*  GLOBAL VARIABLES */
$lat = 47.462625;
//Note! longitude is west negative
$lon = -122.202057;
$zenith = 90.83333;
$SITE['TZ'] = "America/Los Angeles";   // set your timezone
$dtstring   = "M j Y g:ia";         // format for the date & time
$daycolor   = 'lightskyblue';
$ctlcolor   = 'skyblue:0.6';           // Civil Twilight
$ntlcolor   = 'skyblue:0.6';           // Nautical Twilight
$atlcolor   = 'midnightblue:0.9';           // Astronomical Twilight
$nightcolor = 'midnightblue:0.7';
$dawncolor  = 'lightskyblue:0.4';
$pc_cacheFile = 'cache/sunposa.png';

Here is my settings from include-wxastronomy.php
Code: [Select]
/----------------------------------------------------------------------------\\
// SETTINGS: (required)                                                       \\
//----------------------------------------------------------------------------\\

$starryBackground     = true; // show starry background instead of black background
$generate_FrameCode   = false; // set to true if this script is inserted into a frame (will generate html header code)
$includeWDmoonDetails = true; // include WD moondetail1.gif and moondetail2.gif
$includeDayNightMap   = true;  // include earth map showing day and night regions

$includeSunChart      = true;  // include sun chart
$sunChartPHP          = './graphics-sunchart.php'; // Source: https://www.bashewa.com/graphics-sunchart.php?sce=view

$includeSunPath       = true; // include sun path graph
$sunPathPHP           = './sunposa.php'; // see https://www.weather-watch.com/smf/index.php/topic,39197.0.html
$useOtherMoondetail = true; // Use other's moondetails
$otherMoonDetailurl = "./"; // URL for $otherMoonDetailurl

Just not sure what to do next. Any help would be great.

Thanks,
Chuck

Offline the beteljuice

  • the beteljuice
  • Forecaster
  • *****
  • Posts: 316
    • test site
Re: Sunposa.php not working
« Reply #1 on: July 26, 2021, 05:38:11 PM »
1/ Try $jploc = './'; // your files aren't being found

2/ TZ
Code: [Select]
$SITE['TZ'] = "America/Los Angeles";   // set your timezone

// should be ..

$SITE['TZ'] = "America/Los_Angeles";   // set your timezone
Imagine what you will KNOW tomorrow !

Offline andro700

  • Chuck
  • Forecaster
  • *****
  • Posts: 420
    • Gobles Weather Page
Re: Sunposa.php not working
« Reply #2 on: July 27, 2021, 02:41:44 AM »
Worked like a champ. Thanks beteljuice.

Chuck

Offline lddaly

  • Forecaster
  • *****
  • Posts: 490
Re: Sunposa.php not working
« Reply #3 on: July 27, 2021, 03:40:55 PM »
The sunposa.php image is not displaying correctly. The only way I have found to correct this is to modify the DEFAULT_THEME_CLASS name in the jpg-config.inc.php file to an invalid theme. The image does not display correctly with any of the included jpgraph themes selected.
Code: [Select]
// Default theme class name
define('DEFAULT_THEME_CLASS', 'UnknownTheme');
If you make this change and use jpgraphs elsewhere on your site, the theme for those graphs will revert to the default as well.

Offline the beteljuice

  • the beteljuice
  • Forecaster
  • *****
  • Posts: 316
    • test site
Re: Sunposa.php not working
« Reply #4 on: July 27, 2021, 05:15:22 PM »
Old post from jmcmurry (Jim) on a different forum ..

Quote
... you'll need to comment out "required_once('jpgraph_theme.inc.php') from the jpgraph.php script."
Imagine what you will KNOW tomorrow !

Offline andro700

  • Chuck
  • Forecaster
  • *****
  • Posts: 420
    • Gobles Weather Page
Re: Sunposa.php not working
« Reply #5 on: July 28, 2021, 02:29:27 AM »
Only thing left to figure out is my Current Sun & Night Views are not show up. It shows rendered size 0 x 0 when I use Google Inpect.

Chuck

Offline the beteljuice

  • the beteljuice
  • Forecaster
  • *****
  • Posts: 316
    • test site
Re: Sunposa.php not working
« Reply #6 on: July 28, 2021, 09:39:44 AM »
That's because it's what your page asks for ??? - the images are being downloaded.
[scroll to far right]
Code: [Select]
<h4 align="center">Current Sun View</h4><br/>
<img src="https://www.fourmilab.ch/cgi-bin/Earth?img=learth.evif&amp;imgsize=380&amp;dynimg=y&amp;opt=-s&amp;lat=&amp;lon=&amp;alt=&amp;tle=&amp;date=0&amp;utc=&amp;jd=" alt="Earth From Sun" width="0" height="0"/>
</td><td>
<h4 align="center">Current Night View</h4><br/>
<img src="https://www.fourmilab.ch/cgi-bin/Earth?img=learth.evif&amp;imgsize=380&amp;dynimg=y&amp;opt=-n&amp;lat=&amp;lon=&amp;alt=&amp;tle=&amp;date=0&amp;utc=&amp;jd=" alt="Earth Opposite Sun" width="0" height="0"/>
Try changing the width and height attributes to 80% or less (or a fixed px value)
Imagine what you will KNOW tomorrow !

Offline WraxallDave

  • Senior Member
  • **
  • Posts: 65
Re: Sunposa.php not working
« Reply #7 on: July 28, 2021, 10:39:41 AM »
Hi There,

You will find that when you add the horizontal lines to the sunposa.php the background image or gradient color disappears.

To fix this, you set the grid fill to false and you can add the lines and still keep the colored backgrounds.

$graph ->ygrid->SetFill(false);

Dave.


Offline the beteljuice

  • the beteljuice
  • Forecaster
  • *****
  • Posts: 316
    • test site
Re: Sunposa.php not working
« Reply #8 on: July 28, 2021, 11:53:42 AM »
The only problem that I can 'see' for andro page is that the x / y labels are black on a black background.
Code: [Select]
$graph->yaxis->SetFont(FF_ARIAL,FS_BOLD,7);
$graph->yaxis->SetColor('black');
$graph->xaxis->SetFont(FF_ARIAL,FS_BOLD,7);
$graph->xaxis->SetColor('black');
Imagine what you will KNOW tomorrow !

Offline andro700

  • Chuck
  • Forecaster
  • *****
  • Posts: 420
    • Gobles Weather Page
Re: Sunposa.php not working
« Reply #9 on: July 28, 2021, 12:04:12 PM »
Here is the coding for Sun and Night views. Sorry for all the questions I am not real code savvy.

Code: [Select]
div align="center">
<!--
<img src="https://www.fourmilab.ch/cgi-bin/Earth?img=learth.evif&imgsize=640&dynimg=y&opt=-l&lat=40%B047%27&ns=North&lon=96%B037%27&ew=West&alt=35785&tle=&date=0&utc=&jd=" alt="US Day-Night Globe"/>
-->
<h4 align="center">Current View Above USA</h4>
<a href="https://www.fourmilab.ch/cgi-bin/Earth" target="_blank" title="Off Site"><img src="https://www.fourmilab.ch/cgi-bin/Earth?img=nasa.evif&amp;imgsize=700&amp;dynimg=y&amp;opt=-l&amp;lat=40%B047%27&amp;ns=North&amp;lon=96%B037%27&amp;ew=West&amp;alt=35785&amp;tle=&amp;date=0&amp;utc=&amp;jd=" width="<?php echo $divWidth?>" height="<?php echo $divWidth?>" alt="US Day-Night Globe"/></a>
<table align="center" style="width:100%">
<tr align="center" style="width:100%">
<td>
<h4 align="center">Current Sun View</h4><br/>
<img src="https://www.fourmilab.ch/cgi-bin/Earth?img=learth.evif&amp;imgsize=380&amp;dynimg=y&amp;opt=-s&amp;lat=&amp;lon=&amp;alt=&amp;tle=&amp;date=0&amp;utc=&amp;jd=" alt="Earth From Sun" width="<?php echo $divWidth/2?>" height="<?php echo $divWidth/2?>"/>
</td><td>
<h4 align="center">Current Night View</h4><br/>
<img src="https://www.fourmilab.ch/cgi-bin/Earth?img=learth.evif&amp;imgsize=380&amp;dynimg=y&amp;opt=-n&amp;lat=&amp;lon=&amp;alt=&amp;tle=&amp;date=0&amp;utc=&amp;jd=" alt="Earth Opposite Sun" width="<?php echo $divWidth/2?>" height="<?php echo $divWidth/2?>"/>
</td></tr></table>
<h4 align="center">Current Global Map</h4>
<img src="https://www.fourmilab.ch/cgi-bin/Earth?img=nasa.evif&amp;imgsize=640&amp;dynimg=y&amp;opt=-p&amp;lat=&amp;lon=&amp;alt=&amp;tle=&amp;date=0&amp;utc=&amp;jd=" alt="Global Day-NIght" width="640" height="320"/>

Thanks,
Chuck

Offline the beteljuice

  • the beteljuice
  • Forecaster
  • *****
  • Posts: 316
    • test site
Re: Sunposa.php not working
« Reply #10 on: July 28, 2021, 12:48:07 PM »
Apologies ... I did not realise it was a calculated value.
Code: [Select]
width="<?php echo $divWidth/2?>"$divWidth is not defined, so results in zero, the previous full width graphic has a width / height attribute of = ' ' which a browser will 'forgive'.

Either find / define $divWidth, or hardcode (replace <?php echo $divWidth/2?>) with the values you want.
Imagine what you will KNOW tomorrow !

 

anything