Advertisement
johncarlson21

Untitled

Nov 15th, 2017
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.42 KB | None | 0 0
  1. <?php
  2.  
  3. require_once("vendor/autoload.php");
  4.  
  5. use Filestack\FilestackClient;
  6. use Filestack\FilestackSecurity;
  7. use Filestack\Filelink;
  8. use Filestack\FilestackException;
  9.  
  10. $test_api_key = 'Ai1FXgVI1TuSvfUjidnR5z';
  11. $test_secret = 'just_some_random_stuff';
  12. $test_filepath = __DIR__ . '/tests/testfiles/calvinandhobbes.jpg';
  13.  
  14. $sources = [
  15.     'https://d1wtqaffaaj63z.cloudfront.net/images/E-0510.JPG',
  16.     "http://staging2.magicmurals.com/tools/filestack/tests/testfiles/Ultimo_TopNav041816.jpg",
  17.     "http://staging2.magicmurals.com/tools/filestack/tests/testfiles/Ultimo_ColorScheme-041816L.jpg"
  18. ];
  19.  
  20. /**
  21.  * You can create a collage using the client
  22.  */
  23.  
  24. //$security = new FilestackSecurity($test_secret);
  25. $client = new FilestackClient($test_api_key); //, $security);
  26.  
  27. $collage_filelink = $client->collage($sources, 800, 600);
  28. $destination = __DIR__ . '/tests/testfiles/collage-test.png';
  29.  
  30. $result = $collage_filelink->download($destination);
  31. # or
  32. //$contents = $collage_filelink->getContent();
  33. //file_put_contents($destination, $contents);
  34.  
  35. /**
  36.  * Or you can create a collage using a filelink
  37.  */
  38. /*
  39. $filelink = $client->upload($test_filepath);
  40. $collage_filelink = $filelink->collage($sources, 800, 600)->save();
  41.  
  42. $result = $collage_filelink->download($destination);
  43. # or
  44. $contents = $collage_filelink->getContent();
  45. file_put_contents($destination, $contents);
  46.  
  47. // delete remote file
  48. $filelink->delete();
  49. */
  50.  
  51. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement