Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update jpgraph-4.0.2 #95

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config.php.sample
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ else

Define('ROOT', DOC_ROOT."/");
Define('ROOTHTML', "/");
if (!isset( $_SERVER['SERVER_NAME'])) $_SERVER['SERVER_NAME']='localhost';
Define('PROJECT_DOMAIN', $_SERVER['SERVER_NAME']);

// 1-wire OWFS server
Expand Down
Binary file added jpgraph/flags.dat
Binary file not shown.
Binary file added jpgraph/flags_thumb100x100.dat
Binary file not shown.
Binary file added jpgraph/flags_thumb35x35.dat
Binary file not shown.
Binary file added jpgraph/flags_thumb60x60.dat
Binary file not shown.
35 changes: 22 additions & 13 deletions jpgraph/gd_image.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ function SetAntiAliasing($aFlg=true) {
imageantialias($this->img,$aFlg);
}
else {
//JpGraphError::RaiseL(25128);//('The function imageantialias() is not available in your PHP installation. Use the GD version that comes with PHP and not the standalone version.')
// JpGraphError::RaiseL(25128);//('The function imageantialias() is not available in your PHP installation. Use the GD version that comes with PHP and not the standalone version.')
}
}

Expand Down Expand Up @@ -387,8 +387,8 @@ function StrokeBoxedText($x,$y,$txt,$dir=0,$fcolor="white",$bcolor="black",
$shadowcolor=false,$paragraph_align="left",
$xmarg=6,$ymarg=4,$cornerradius=0,$dropwidth=3) {

$oldx = $this->lastx;
$oldy = $this->lasty;
$oldx = $this->lastx;
$oldy = $this->lasty;

if( !is_numeric($dir) ) {
if( $dir=="h" ) $dir=0;
Expand Down Expand Up @@ -459,8 +459,8 @@ function StrokeBoxedText($x,$y,$txt,$dir=0,$fcolor="white",$bcolor="black",
$this->SetTextAlign($h,$v);

$this->SetAngle($olda);
$this->lastx = $oldx;
$this->lasty = $oldy;
$this->lastx = $oldx;
$this->lasty = $oldy;

return $bb;
}
Expand All @@ -482,8 +482,8 @@ function StrokeBoxedText2($x,$y,$txt,$dir=0,$fcolor="white",$bcolor="black",
JpGraphError::RaiseL(25131);//StrokeBoxedText2() Only support TTF fonts and not built in bitmap fonts
}

$oldx = $this->lastx;
$oldy = $this->lasty;
$oldx = $this->lastx;
$oldy = $this->lasty;
$dir = $this->NormAngle($dir);

if( !is_numeric($dir) ) {
Expand Down Expand Up @@ -614,8 +614,8 @@ function StrokeBoxedText2($x,$y,$txt,$dir=0,$fcolor="white",$bcolor="black",
$this->SetTextAlign($h,$v);
$this->SetAngle($olda);

$this->lastx = $oldx;
$this->lasty = $oldy;
$this->lastx = $oldx;
$this->lasty = $oldy;

return $bb;
}
Expand Down Expand Up @@ -1118,7 +1118,7 @@ function SetMargin($lm,$rm,$tm,$bm) {

if( $this->width > 0 && $this->height > 0 ) {
if( $this->plotwidth < 0 || $this->plotheight < 0 ) {
JpGraphError::RaiseL(25130, $this->plotwidth, $this->plotheight);
JpGraphError::RaiseL(25130, $this->plotwidth, $this->plotheight);
//JpGraphError::raise("To small plot area. ($lm,$rm,$tm,$bm : $this->plotwidth x $this->plotheight). With the given image size and margins there is to little space left for the plot. Increase the plot size or reduce the margins.");
}
}
Expand Down Expand Up @@ -1660,15 +1660,24 @@ function SetQuality($q) {
}

// Stream image to browser or to file
function Stream($aFile="") {
function Stream($aFile=NULL) {
$this->DoSupersampling();

$func="image".$this->img_format;
if( $this->img_format=="jpeg" && $this->quality != null ) {
$res = @$func($this->img,$aFile,$this->quality);
}

if(!$res){
if($aFile != NULL){
JpGraphError::RaiseL(25107,$aFile);//("Can't write to file '$aFile'. Check that the process running PHP has enough permission.");
}else{
JpGraphError::RaiseL(25108);//("Can't stream image. This is most likely due to a faulty PHP/GD setup. Try to recompile PHP and use the built-in GD library that comes with PHP.");
}

}
}
else {
if( $aFile != "" ) {
if( $aFile != NULL ) {
$res = @$func($this->img,$aFile);
if( !$res ) {
JpGraphError::RaiseL(25107,$aFile);//("Can't write to file '$aFile'. Check that the process running PHP has enough permission.");
Expand Down
138 changes: 138 additions & 0 deletions jpgraph/jpg-config.inc.php.orig
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
<?php
//=======================================================================
// File: JPG-CONFIG.INC
// Description: Configuration file for JpGraph library
// Created: 2004-03-27
// Ver: $Id: jpg-config.inc.php 1871 2009-09-29 05:56:39Z ljp $
//
// Copyright (c) Asial Corporation. All rights reserved.
//========================================================================


//------------------------------------------------------------------------
// Directories for cache and font directory.
//
// CACHE_DIR:
// The full absolute name of the directory to be used to store the
// cached image files. This directory will not be used if the USE_CACHE
// define (further down) is false. If you enable the cache please note that
// this directory MUST be readable and writable for the process running PHP.
// Must end with '/'
//
// TTF_DIR:
// Directory where TTF fonts can be found. Must end with '/'
//
// The default values used if these defines are left commented out are:
//
// UNIX:
// CACHE_DIR /tmp/jpgraph_cache/
// TTF_DIR /usr/share/fonts/truetype/
// MBTTF_DIR /usr/share/fonts/truetype/
//
// WINDOWS:
// CACHE_DIR $SERVER_TEMP/jpgraph_cache/
// TTF_DIR $SERVER_SYSTEMROOT/fonts/
// MBTTF_DIR $SERVER_SYSTEMROOT/fonts/
//
//------------------------------------------------------------------------
// define('CACHE_DIR','/tmp/jpgraph_cache/');
// define('TTF_DIR','/usr/share/fonts/truetype/');
// define('MBTTF_DIR','/usr/share/fonts/truetype/');

//-------------------------------------------------------------------------
// Cache directory specification for use with CSIM graphs that are
// using the cache.
// The directory must be the filesysystem name as seen by PHP
// and the 'http' version must be the same directory but as
// seen by the HTTP server relative to the 'htdocs' ddirectory.
// If a relative path is specified it is taken to be relative from where
// the image script is executed.
// Note: The default setting is to create a subdirectory in the
// directory from where the image script is executed and store all files
// there. As ususal this directory must be writeable by the PHP process.
define('CSIMCACHE_DIR','csimcache/');
define('CSIMCACHE_HTTP_DIR','csimcache/');

//------------------------------------------------------------------------
// Various JpGraph Settings. Adjust accordingly to your
// preferences. Note that cache functionality is turned off by
// default (Enable by setting USE_CACHE to true)
//------------------------------------------------------------------------

// Deafult locale for error messages.
// This defaults to English = 'en'
define('DEFAULT_ERR_LOCALE','en');

// Deafult graphic format set to 'auto' which will automatically
// choose the best available format in the order png,gif,jpeg
// (The supported format depends on what your PHP installation supports)
define('DEFAULT_GFORMAT','auto');

// Should the cache be used at all? By setting this to false no
// files will be generated in the cache directory.
// The difference from READ_CACHE being that setting READ_CACHE to
// false will still create the image in the cache directory
// just not use it. By setting USE_CACHE=false no files will even
// be generated in the cache directory.
define('USE_CACHE',false);

// Should we try to find an image in the cache before generating it?
// Set this define to false to bypass the reading of the cache and always
// regenerate the image. Note that even if reading the cache is
// disabled the cached will still be updated with the newly generated
// image. Set also 'USE_CACHE' below.
define('READ_CACHE',true);

// Determine if the error handler should be image based or purely
// text based. Image based makes it easier since the script will
// always return an image even in case of errors.
define('USE_IMAGE_ERROR_HANDLER',true);

// Should the library examine the global php_errmsg string and convert
// any error in it to a graphical representation. This is handy for the
// occasions when, for example, header files cannot be found and this results
// in the graph not being created and just a 'red-cross' image would be seen.
// This should be turned off for a production site.
define('CATCH_PHPERRMSG',true);

// Determine if the library should also setup the default PHP
// error handler to generate a graphic error mesage. This is useful
// during development to be able to see the error message as an image
// instead as a 'red-cross' in a page where an image is expected.
define('INSTALL_PHP_ERR_HANDLER',false);

// Should usage of deprecated functions and parameters give a fatal error?
// (Useful to check if code is future proof.)
define('ERR_DEPRECATED',true);

// The builtin GD function imagettfbbox() fuction which calculates the bounding box for
// text using TTF fonts is buggy. By setting this define to true the library
// uses its own compensation for this bug. However this will give a
// slightly different visual apparance than not using this compensation.
// Enabling this compensation will in general give text a bit more space to more
// truly reflect the actual bounding box which is a bit larger than what the
// GD function thinks.
define('USE_LIBRARY_IMAGETTFBBOX',true);

//------------------------------------------------------------------------
// The following constants should rarely have to be changed !
//------------------------------------------------------------------------

// What group should the cached file belong to
// (Set to '' will give the default group for the 'PHP-user')
// Please note that the Apache user must be a member of the
// specified group since otherwise it is impossible for Apache
// to set the specified group.
define('CACHE_FILE_GROUP','www');

// What permissions should the cached file have
// (Set to '' will give the default persmissions for the 'PHP-user')
define('CACHE_FILE_MOD',0664);

// Default theme class name
define('DEFAULT_THEME_CLASS', 'FusionTheme');

define('SUPERSAMPLING', true);
define('SUPERSAMPLING_SCALE', 1);

?>
Loading