daily pastebin goal
1%
SHARE
TWEET

Untitled

a guest Aug 10th, 2018 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.    function showImage($contents, $export="png")  {
  2.       global $CFG_GLPI;
  3.       if ($export!="odt" && $export!="odtall") {
  4.  
  5.          $show_inline = true;
  6.        
  7.          //test browser (if ie < 9, show img from temp dir instead base64 inline)
  8.          $ua = trim(strtolower($_SERVER["HTTP_USER_AGENT"]));
  9.          $pattern = "/msie\s(\d+)\.0/";
  10.          if(preg_match($pattern,$ua,$arr)){
  11.             $ie_version = $arr[0];
  12.             if (version_compare($ie_version, '9.0') < 0) {
  13.                $show_inline = false;
  14.                $rand=mt_rand();
  15.                $filename_tmp = GLPI_ROOT."/files/_tmp/mreporting_img_$rand.png";
  16.                file_put_contents($filename_tmp, $contents);
  17.  
  18.                echo "<img src='$filename_tmp' alt='graph' title='graph' />";
  19.             }
  20.          }
  21.            
  22.          if ($show_inline)
  23.             echo "<img src='data:image/png;base64,".base64_encode($contents)
  24.                ."' alt='graph' title='graph' />";
  25.          
  26.       }
  27.    }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top