use data links for git graph images
[phpgitweb.git] / htdocs / lib / PageClasses.shortlog.class.php
index 75573f28abde66f1b9d6cc20eb3e10ecb332f0b9..500167501471ad0053f35763cce2aa9fb6c2296a 100644 (file)
@@ -18,7 +18,7 @@
 
 class shortlog {
        private $project;
-       private $graph_data;
+       private $graph_data, $graph_gen;
        private $first_commit;
        private $have_more = false;
        
@@ -61,7 +61,16 @@ class shortlog {
                                }
                        }
                        $this->graph_data->parse($commits);
-                       $content->set('graph_data', $this->graph_data->get_header_graph());
+                       
+                       $graph = $this->graph_data->get_header_graph();
+                       if(GitConfig::GITGRAPH_DATA_URL) {
+                               $this->graph_gen = new graph_image_generator();
+                               $graph = $this->graph_gen->generate($graph, true);
+                               $graph = base64_encode($graph);
+                               $graph = "data:image/png;base64,".$graph;
+                       } else
+                               $graph = "?e=graph&gd=".$graph;
+                       $content->set('graph_data', $graph);
                }
                
                $commit_counter = 0;
@@ -108,8 +117,16 @@ class shortlog {
                        $entry->set('date', $date_str);
                        $entry->set('age', $age_str);
                }
-               if(GitConfig::GITGRAPH_ENABLE)
-                       $entry->set('graph_data', $this->graph_data->get_graph($commit['id']));
+               if(GitConfig::GITGRAPH_ENABLE) {
+                       $graph = $this->graph_data->get_graph($commit['id']);
+                       if(GitConfig::GITGRAPH_DATA_URL) {
+                               $graph = $this->graph_gen->generate($graph, true);
+                               $graph = base64_encode($graph);
+                               $graph = "data:image/png;base64,".$graph;
+                       } else
+                               $graph = "?e=graph&gd=".$graph;
+                       $entry->set('graph_data', $graph);
+               }
                
                $entry->set('refs', $this->shortlog_commit_refs($this->project, $commit['id']));