watermark toil

From Beefy Cassowary, 2 Years ago, written in PHP, viewed 137 times.
URL https://paste.bugabuse.net/view/ead33ab0 Embed
Download Paste or View Raw
  1. <?php
  2.  
  3. $do_watermark=1;
  4. $root = "/home/www/nes-wiki.org/htdocs/wiki/";
  5. $filename1 = $_SERVER['QUERY_STRING'];
  6. $filename= "$root/$filename1";
  7. list($width, $height, $type, $attr) = getimagesize($filename);
  8. if($type == 1) { //gif
  9. $fileext = "GIF";
  10. $t = imagecreatefromgif("$filename");
  11. $do_watermark=0;
  12. } elseif ($type == 2) { //.JPG
  13. $fileext = "JPG";
  14. $t = imagecreatefromjpeg("$filename");
  15. }
  16.  
  17. //I didn't want small images to be watermarked
  18. //I can't remember exactly why I did it this way,
  19. //I think it had something to do with some PHP functions not working
  20. #if(($width*$height)>307200) {
  21. #$do_watermark = 0;
  22. #}
  23. if($do_watermark == 1) {
  24. $white = imagecolorallocate($t, 255, 255, 255);
  25. $text = "© 2010 - wistreetscene.com.";
  26. $font='/usr/share/fonts/truetype/freefont/FreeSansBold.ttf';
  27. imagettftext($t,8,0,10,15,$white,$font,$text);
  28. if($type == 1) { //gif
  29. Header("Content-type: image/gif");
  30. } elseif ($type == 2) { //.JPG
  31. Header("Content-type: image/jpeg");
  32. }
  33. } else {
  34. Header("Content-type: image/jpeg");
  35. }
  36. ?>
  37.  
  38.  
  39. RewriteRule ^wiki/images/(.*\.JPG)$ rewrite.php?/images/$1 [NC,L,QSA]
  40.  

Reply to "watermark toil"

Here you can reply to the paste above