Guest User

Untitled

a guest
Nov 25th, 2017
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.17 KB | None | 0 0
  1. <?php
  2.  
  3. $username="root";
  4. $password="maverick";
  5. $database="arduino";
  6.    
  7. mysql_connect(localhost,$username,$password);
  8. @mysql_select_db($database) or die( "Unable to select database");
  9.  
  10. $result = mysql_query("SELECT * FROM temp");
  11. $status = mysql_result($result, 1, temp);
  12.  
  13. //$status = mysql_result($result, 0, "data");
  14.  
  15. $data = $status; //explode("|", $status);
  16.  
  17. $font = "aerial.ttf";
  18.  
  19. $image = imagecreatefrompng("254.png");
  20. $font_size = 10;
  21.  
  22. $color = imagecolorallocate($image, 255,255,255);
  23. $black = imagecolorallocate($image, 0,0,0);
  24.  
  25. ImageTTFText ($image, $font_size, 0, 4, 12, $black, $font, "Temp: " . $data . "C");
  26. ImageTTFText ($image, $font_size, 0, 4, 12, $color, $font, "Temp: " . $data . "C");
  27.  
  28. // ImageTTFText ($image, $font_size, 0, 110, 12, $black, $font, "Humidity: " . $data[2] . "%");
  29. // ImageTTFText ($image, $font_size, 0, 110, 12, $color, $font, "Humidity: " . $data[2] . "%");
  30.  
  31. // ImageTTFText ($image, $font_size, 0, 242, 12, $black, $font, "Fan: " . $data[3] . "rpm");
  32. // ImageTTFText ($image, $font_size, 0, 242, 12, $color, $font, "Fan: " . $data[3] . "rpm");
  33.  
  34. header("Content-type: image/png");
  35. imagepng($image);
  36. imagedestroy($image);
  37. ?>
Add Comment
Please, Sign In to add comment