Advertisement
Guest User

Untitled

a guest
Nov 8th, 2018
310
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1. <?php
  2.  
  3. if(isset($_POST['create'])) {
  4. require_once 'module/instagram-photo-upload-api.php';
  5.  
  6. echo "<label>Result :</label>";
  7.  
  8. $folder = "files/autoquotemaker/";
  9.  
  10. $overlay = $folder."overlay.png";
  11. $font_quote = "files/_font/"."Chicle-Regular.ttf";
  12. $font_copyright = "files/_font/"."KrinkesRegularPERSONAL.ttf";
  13. $filename = $folder.md5(rand(000,999)).".png";
  14. $quote = @$_POST['quote'] ? $_POST['quote'] : 'YOUR QUOTE';
  15. $copyright = @$_POST['copyright'] ? $_POST['copyright'] : 'bacotangw9';
  16. $backgrond = @$_POST['background'];
  17. $username = 'uname';
  18. $password = 'pass';
  19. $caption = "auto post";
  20.  
  21.  
  22. if (!filter_var($backgrond, FILTER_VALIDATE_URL) === false) {
  23. $bg = $backgrond;
  24. }else {
  25. $bg = get_redirect_target('https://source.unsplash.com/640x640/?'.urlencode($backgrond));
  26. }
  27.  
  28. $image = new PHPImage();
  29. $image->setQuality(10);
  30. $image->setDimensionsFromImage($overlay);
  31. $image->draw($bg);
  32. $image->draw($overlay, '50%', '75%');
  33. $image->setFont($font_quote);
  34. $image->setTextColor(array(255, 255, 255));
  35. $image->setAlignVertical('center');
  36. $image->setAlignHorizontal('center');
  37. $image->textBox($quote, array(
  38. 'fontSize' => 28,
  39. 'x' => 60,
  40. 'y' => 215,
  41. 'width' => 520,
  42. 'height' => 110,
  43. 'debug' => false
  44. ));
  45. $image->setFont($font_copyright);
  46. $image->setTextColor(array(255, 255, 255));
  47. $image->text('' .$copyright, array(
  48. 'fontSize' => 30,
  49. 'x' => 0,
  50. 'y' => 400,
  51. 'width' => 640,
  52. 'height' => 20,
  53. 'debug' => false
  54. ));
  55. $image->save($filename);
  56.  
  57.  
  58.  
  59. $newfile = $folder.md5(rand(000,999)).".jpg";
  60. imagejpeg(imagecreatefromstring(file_get_contents($filename)), $newfile);
  61. unlink($filename);
  62.  
  63. $imagebase64 = "data:image/png;base64,".base64_encode(file_get_contents($newfile));
  64. // Upload Photo
  65. $obj = new InstagramUpload();
  66. $obj->Login("unameig", "passig");
  67. $obj->UploadPhoto($newfile, "auto post");
  68. unlink($newfile);
  69.  
  70. }
  71.  
  72. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement