Advertisement
Guest User

Untitled

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