Contents Previous

# 13 Code defines in JpGraph

Various settings in JpGraph are controlled by overall DEFINEs at the top of jpgraph.php. Most of these defines should not have to be changed by the regular user but left at their default values. Below is a complete table of all defines and their meaning.

Define, default value | Comment
--- | ---
"CACHE_DIR","/tmp/jpgraph_cache/" | The full absolute name of directory to be used as a cache. This directory must be readable and writable for PHP. Must end with '/'
"TTF_DIR","/usr/local/fonts/ttf/" | Directory for JpGraph TTF fonts. Must end with '/' Note: The fonts must follow the naming conventions as used by the supplied TTF fonts in JpGraph.
"USE_LIBRARY_GD2",false | Specify if we should use GD 2.x or GD 1.x If you have GD 2.x installed it is recommended that you use it since it will give a slightly, slightly better visual appearance for arcs. If you don't have GD2 installed this must be set to false!
'USE_TRUECOLOR',true | Should the image be a truecolor image? Note 1: Can only be used with GD 2.0.2 and above. Note 2: GD 2.0.1 + PHP 4.0.6 on Win32 crashes when trying to use truecolor. Truecolor support is to be considered alpha since GD 2.x is still not considered stable (especially on Win32). Note 3: MUST be enabled to get background images working with GD2 Note 4: If enabled then truetype fonts will look very ugly => You can't have both background images and truetype fonts in the same image until these bugs has been fixed in GD 2.01
"USE_CACHE",false | 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.
"READ_CACHE",true | 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.
"DEFAULT_GFORMAT","auto" | Default graphic format set to "auto" which will automatically choose the best available format in the order png,gif,jpg (The supported format depends on what your PHP installation supports)
"USE_IMAGE_ERROR_HANDLER",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.
"USE_APPROX_COLORS",true | If the color palette is full should JpGraph try to allocate the closest match? If you plan on using background image or gradient fills it might be a good idea to enable this. If not you will otherwise get an error saying that the color palette is exhausted. The drawback of using approximations is that the colors might not be exactly what you specified. Note1: This does only apply to paletted images, not truecolor images since they don't have the limitations of maximum number of colors.
"LANGUAGE_CYRILLIC",false | Special unicode language support
"ERR_DEPRECATED",false | Should usage of deprecated functions and parameters give a fatal error? (Useful to check if code is future proof.)
"BRAND_TIMING",false | Should the time taken to generate each picture be branded to the lower left in corner in each generated image? Useful for performance measurements generating graphs
"BRAND_TIME_FORMAT","Generated in: %01.3fs" | What format should be used for the timing string?

The following defines should very rarely need to be changed

Define, default value | Comment
--- | ---
"CACHE_FILE_GROUP","wwwadmin" | 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.
"CACHE_FILE_MOD",0664 | What permissions should the cached file have (Set to "" will give the default permissions for the "PHP-user")
"USE_BRESENHAM",false | Decide if we should use the Bresenham circle algorithm or the built in Arc(). Bresenham gives better visual appearance of circles but is more CPU intensive and slower then the built in Arc() function in GD. Turned off by default for speed
"JPG_DEBUG",false | Enable some extra internal debug information to be shown. (Should only be changed if your first name is Johan and you happen to know what you are doing. You have been warned.)
"_CSIM_SPECIALFILE","_csim_special_" | Special file name to indicate that we only want to calc the image map in the call to Graph::Stroke() used internally from the GetHTMLCSIM() method.
"_CSIM_DISPLAY","_jpg_csimd" | HTTP GET argument that is used with image map to indicate to the script to just generate the image and not the full CSIM HTML page.

Contents Previous