~helioviewer/helioviewer.org/1.0

« back to all changes in this revision

Viewing changes to api/lib/helioviewer/SubFieldImage.php

  • Committer: V. Keith Hughitt
  • Date: 2009-07-30 13:13:26 UTC
  • mfrom: (233.1.59 helioviewer)
  • Revision ID: hughitt1@kore-20090730131326-69sq8n2z24748la5
2009/07/30 post-merge save

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
                // The true/false parameter means whether to display the image or not when finished building it (used for debugging).
24
24
                $this->getImage(false);
25
25
        }
26
 
        
 
26
 
 
27
        /**
 
28
         * Checks the cache to see if the image is already there, and uses it if it is. If not, it builds the image.
 
29
         * @param object $display -- true or false
 
30
         */     
27
31
        function getImage($display) {
28
32
                // JPG or PNG
29
33
                $format = $this->getImageFormat();
40
44
                
41
45
                else {  
42
46
                        // If it's not cached, build it and put it in the cache.
43
 
                        // The true/false parameter means whether the image is a tile or not (tiles are padded, subfieldimages are only padded with -gravity Center for now).
44
47
                $this->image = $this->buildImage($filepath);    
45
48
                                
46
49
                // Display image
51
54
        
52
55
        /**
53
56
         * @description Gets the filepath of where the image will go in the cache directory. 
54
 
         * @description Filepaths are of the format /var/www/helioviewer/cache/movies/year/month/day/obs/inst/det/meas/image_uri
 
57
         * @description Filepaths are of the format /var/www/helioviewer/cache/movies/fileTimeStamp
55
58
         * @return $filepath
56
59
         * @param object $format is something like "jpg" or "png"
57
60
         */     
76
79
                        }                       
77
80
                }
78
81
 
79
 
                // Convert coordinates to strings
 
82
                // Convert coordinates to strings, padding 0's in the front of single digits
80
83
                $xStartStr = "+" . str_pad($this->xRange["start"], 2, '0', STR_PAD_LEFT);
81
84
                if (substr($this->xRange["start"],0,1) == "-")
82
85
                        $xStartStr = "-" . str_pad(substr($this->xRange["start"], 1), 2, '0', STR_PAD_LEFT);
100
103
                return $filepath;
101
104
        }
102
105
        
 
106
        /**
 
107
         * Returns the filepath of the image, which is in the cache once it is built.
 
108
         */
103
109
        function getCacheFilepath() {
104
110
                return $this->image;
105
111
        }