Guest User

Untitled

a guest
Dec 16th, 2017
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. function black() {
  2. $imgname = "cheetah.png";
  3. $im = imagecreatefrompng ($imgname);
  4.  
  5. $index = imagecolorexact ($im,0,0,0);
  6. imagecolorset($im,$index,255,0,0);
  7.  
  8. $imgname = "cheetah2.png";
  9. imagepng($im,$imgname);
  10. }
  11. //------------------------------------------------------------------
  12.  
  13. function white() {
  14. $imgname = "cheetah.png";
  15. $im = imagecreatefrompng ($imgname);
  16.  
  17. $index = imagecolorexact ($im,255,255,255);
  18. imagecolorset($im,$index,0,0,0);
  19.  
  20. $index = imagecolorexact ($im,0,0,0);
  21. imagecolorset($im,$index,255,255,255);
  22.  
  23. $imgname = "cheetah2.png";
  24. imagepng($im,$imgname);
  25. }
  26. //-----------------------------------------------------------------
  27.  
  28. if (isset($_GET['black'])) {
  29. black();
  30. }
  31.  
  32. if (isset($_GET['white'])) {
  33. white();
  34. }
  35.  
  36. clearstatcache();
  37.  
  38. <div class="col-rep">
  39. <h3>Select a color in pallete and see the result:</h3><br>
  40. <img class="col-rep-img" src="cheetah.png">
  41. <a href="?black=true" class="black color"></a>
  42. <a href="?white=true" class="white color"></a>
  43. <img class="col-rep-img" src="cheetah2.png?1">
  44. </div>
Add Comment
Please, Sign In to add comment