/adei/trunk

To get this branch, use:
bzr branch http://darksoft.org/webbzr/adei/trunk

« back to all changes in this revision

Viewing changes to classes/drawtext.php

  • Committer: Suren A. Chilingaryan
  • Date: 2009-03-04 05:13:39 UTC
  • Revision ID: csa@dside.dyndns.org-20090304051339-68sc926t9pwqhiv5
Reuse generated png files in low precision mode (to speedup wiki)

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
    if ($req) $this->req = $req;
19
19
    else $this->req = new REQUEST();
20
20
    
 
21
    $this->ready = false;
21
22
 
22
23
    if (isset($this->req->props['height'])) $this->height = $this->req->props['height'];
23
24
    else $this->height = $GRAPH_DEFAULT_HEIGHT;
25
26
    else $this->width = $GRAPH_DEFAULT_WIDTH;
26
27
 
27
28
    $this->tmpfile = $this->GetTmpFile();
28
 
 
29
 
    $this->ready = false;
30
29
 }
31
30
 
32
31
 function GetTmpFile() {
104
103
        return true;
105
104
    }
106
105
 
 
106
    $fp = fopen($TMP_PATH . "/" . $this->tmpfile . ".tmp", "w+");
 
107
    if ($fp) flock($fp, LOCK_EX);
107
108
    $this->graph->Stroke($TMP_PATH . "/" . $this->tmpfile);
 
109
    if ($fp) fclose($fp);
 
110
    
108
111
    return $this->tmpfile;
109
112
 }
110
113
 
113
116
    
114
117
    if ($file) {
115
118
        if (preg_match("/^[A-Za-z0-9\/_]\.png$/",$str)) return false;
116
 
        return @readfile($TMP_PATH . "/" . $file);
 
119
        
 
120
        $fp = fopen($TMP_PATH . "/" . $file . ".tmp", "w+");
 
121
        if ($fp) flock($fp, LOCK_SH);
 
122
        $res =  @readfile($TMP_PATH . "/" . $file);
 
123
        if ($fp) fclose($fp);
 
124
        
 
125
        return $res;
117
126
    }
118
127
 
119
128
    return false;