Board index   FAQ   Search  
Register  Login
Board index PHP PHP General

JpGraph Error: 25111

General discussions related to php

Moderators: macek, egami, gesf

JpGraph Error: 25111

Postby jorgemsp » Mon Sep 17, 2012 2:40 pm

Hi everyone!

Before start, sorry if this topic is in the wrong place, but i'm new in the forum :S

So,
probably this is the most common error you find when using JpGraph, but even after google for a solution I still get this error...
JpGraph Error: 25111 Can't delete cached image C:\xampp\htdocs\USF\tmp.jpgraph\ima4DA5.tmp. Permission problem?

I already tried to watch over php.ini and I made sure that GD was enabled, I also changed windows 7 security access to the temporary folder where images are saved. But it seems that something misses, any suggestion??

My code is a copy of one used as an example in the official page of JpGraph:
Code: Select all
<?php
    //criar $data
?>
 <?php
       define('PREFIX_DIR', 'tmp.jpgraph');   // images will be created here
       define('PREFIX', 'imagemABC');   // prefix for the images, can be anything
       define('TIME_LIMIT', 3 * 60);    // 3 minutes
       $tmpfname = tempnam(PREFIX_DIR, PREFIX);   // create temp filename
?>
 <?php // content="text/plain; charset=utf-8"
    require_once ('jpgraph/src/jpgraph.php');
    require_once ('jpgraph/src/jpgraph_line.php');

    // Some data
    $ydata = array(11,3,8,12,5,1,9,13,5,7);

    // Create the graph. These two calls are always required
    $graph = new Graph(350,250);
    $graph->SetScale('textlin');

    // Create the linear plot
    $lineplot=new LinePlot($ydata);
    $lineplot->SetColor('blue');

    // Add the plot to the graph
    $graph->Add($lineplot);

    // Display the graph
    $graph->Stroke($tmpfname);
    clean_old_tmp_files();
?>
    <img src="<?php echo get_relative_path($tmpfname); ?>">
   
  <?php
        #unlink($tmpfname);   // wouldn't work correctly
?>
  <?php
    function get_relative_path($filename)
    {
          return preg_replace("/^.*\/(".PREFIX_DIR."\/.*)/", "$1", $filename);
       }

       function clean_old_tmp_files()
       {
             foreach (glob(PREFIX_DIR.'/'.PREFIX."*") as $filename)
             {
                #printf ( "Name: %s; age: %d<br>\n", $filename, time() - filemtime($filename) );

                $age = time() - filemtime($filename);
           if ($age > TIME_LIMIT)
           {
                     unlink($filename);
                }
             }
        }
?>
jorgemsp
New php-forum User
New php-forum User
 
Posts: 1
Joined: Mon Sep 17, 2012 2:29 pm

Re: JpGraph Error: 25111

Postby johnj » Mon Sep 17, 2012 11:13 pm

try cleaning up your cached files folder. Then, make sure you do not cache anything in future by using something similar - header("Cache-Control: no-cache, must-revalidate");
header("Expires: Sat, 01 Jan 2000 00:00:00 GMT");
johnj
php-forum Super User
php-forum Super User
 
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm


Return to PHP General

Who is online

Users browsing this forum: Google [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.