Guest User

Untitled

a guest
Jun 23rd, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.27 KB | None | 0 0
  1. <?php
  2.     if($_GET['submit']) {
  3.         //Set the Content Type
  4.         header('Content-type: image/jpeg');
  5.  
  6.  
  7.  
  8.         $imgurl = $_GET["imgurl"];//, "memetype", "cap1", "cap1font", "cap2", "cap2font"];
  9.         $memetype = $_GET["memetype"];
  10.         $cap1 = $_GET["cap1"];
  11.         $cap1font = intval($_GET["cap1font"]);
  12.         $cap2 = $_GET["cap2"];
  13.         $cap2font = intval($_GET["cap2font"]);
  14.  
  15.  
  16.        
  17.         // Create file location
  18.         $image_location = '/saved/' . $memetype . '-' . $cap1 . '-' . $cap1font . '-' . $cap2 . '-' . $cap2font . '.jpg';
  19.         echo $image_location;
  20.  
  21.            
  22.         $jpg_image = imagecreatefromjpeg($imgurl);
  23.        
  24.         // Allocate A Color For The Text
  25.         $white = imagecolorallocate($jpg_image, 255, 255, 255);
  26.        
  27.         // Set Path to Font File
  28.         $font_path = "impact.ttf";
  29.        
  30.         // Set Text to Be Printed On Image
  31.         $text = $cap1;
  32.        
  33.         // Print Text On Image
  34.         imagettftext($jpg_image, 25, 0, 75, 300, $white, $font_path, $text);
  35.        
  36.         // Save Image to generated location
  37.         imagejpeg($jpg_image,$image_location);
  38.         echo '<img src="' . $image_location . '">';
  39.         // Clear Memory
  40.         imagedestroy($jpg_image);
  41.     }
  42.  
  43. ?>
Add Comment
Please, Sign In to add comment