Advertisement
kajacx

Verrit Meme Generator

Sep 9th, 2017
395
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.28 KB | None | 0 0
  1. <?php
  2.  
  3. $imageBg = imageCreateFromJpeg('0S8cX71.jpg');
  4. $fontArial = 'Arial_Bold.ttf';
  5.  
  6. $code = isset($_GET['code']) ? $_GET['code'] : null; // '4810520';
  7. $source = isset($_GET['source']) ? $_GET['source'] : null; // 'Definetely not fake news CNN';
  8. $text = isset($_GET['text']) ? $_GET['text']: null; // 'Lorem ipsum\ndolor sit amed\nconsequetuer dolor.';
  9. $quote = isset($_GET['quote']) ? $_GET['quote']: null; // '- Prophet Pepe, the relevations of Kek';
  10.  
  11. if($text) {
  12.     $blackColor = imagecolorallocate($imageBg, 0, 0, 0);
  13.  
  14.     //varified code:
  15.     $verifSize = 19;
  16.     $verifX = 488;
  17.     $verifY = 600 - 57;
  18.     imagettftext($imageBg, $verifSize, 0, $verifX, $verifY, $blackColor, $fontArial, $code);
  19.  
  20.     //source:
  21.     $sourceSize = 17;
  22.     $sourceX = 90;
  23.     $sourceY = 600 - 48;
  24.     imagettftext($imageBg, $sourceSize, 90, $sourceX, $sourceY, $blackColor, $fontArial, $source);
  25.  
  26.     //text:
  27.     $textSize = 40;
  28.     $textX = 166;
  29.     $textY = 600 - 400;
  30.     imagettftext($imageBg, $textSize, 0, $textX, $textY, $blackColor, $fontArial, '“'.str_replace('\n', "\n", $text).'”');
  31.  
  32.     //quote:
  33.     $quoteSize = 30;
  34.     $quoteX = 166;
  35.     $quoteY = 600 - 340 + 70 * substr_count($text, '\n');
  36.     imagettftext($imageBg, $quoteSize, 0, $quoteX, $quoteY, $blackColor, $fontArial, $quote);
  37.  
  38.     //get image data
  39.     ob_start();
  40.     imagepng($imageBg);
  41.     $imgData = base64_encode(ob_get_clean());
  42.  
  43.     //destroy image ibjects
  44.     imagedestroy($imageBg);
  45. }
  46.  
  47. ?>
  48.  
  49. <div>
  50.     <div style="display: inline-block;">
  51.         <h3>Real Verrit:</h3>
  52.         <image style="width: 600px; height: 300px" src="verrit-0443118.jpg" />
  53.     </div>
  54.     <div style="display: inline-block;">
  55.         <h3>Fake Verrit from this generator:</h3>
  56.         <image style="width: 600px; height: 300px" src="download.png" />
  57.     </div>
  58. </div>
  59.  
  60. <?php
  61. if(isset($imgData)) {
  62.     ?>
  63.     <h3 style="color: red;">Your Verrit:</h3>
  64.     <image style="width: 600px; height: 300px" src="data:image/png;base64,<?= $imgData ?>" /> <br />
  65.     <?php
  66. }
  67. ?>
  68.  
  69. <h1>Verrit fake image generator</h1>
  70. <form method="GET">
  71.     <table>
  72.         <tr>
  73.             <td>Main text:</td>
  74.             <td><input name="text" value="<?= $text ?>" size="80" placeholder="Fake quote\nanother line." /></td>
  75.             <td>The main text without the double quotes. Use \n to separate lines.</td>
  76.         </tr>
  77.         <tr>
  78.             <td>Quote by:</td>
  79.             <td><input name="quote" value="<?= $quote ?>" size="80" placeholder="Prophet Pepe, the relevations of Kek" /></td>
  80.             <td>Who is the quote from (include the dash at the start to make it look more authentic)</td>
  81.         </tr>
  82.         <tr>
  83.             <td>Source:</td>
  84.             <td><input name="source" value="<?= $source ?>" size="80" placeholder="Definetely not fake news CNN" /></td>
  85.             <td>Source of this quote (include a date to make it look more authentic)</td>
  86.         </tr>
  87.         <tr>
  88.             <td>Code:</td>
  89.             <td><input name="code" value="<?= $code ?>" size="80" placeholder="4810520" /></td>
  90.             <td>7-digit verification code</td>
  91.         </tr>
  92.         <tr>
  93.             <td></td>
  94.             <td><input type="submit" value="Generate" /></td>
  95.             <td>Praise Kek.</td>
  96.         </tr>
  97.     </table>
  98. </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement