filestack / filestack-php

Official PHP SDK for Filestack - API and content management system that makes it easy to add powerful file uploading and transformation capabilities to any web or mobile application.
https://www.filestack.com
Apache License 2.0
56 stars 32 forks source link

example collage not working for me. #31

Closed johncarlson21 closed 6 years ago

johncarlson21 commented 6 years ago

I'm trying to use the example collage, but it just isn't working. I'm getting an error, I'm guessing on the sources.

this is my code: https://pastebin.com/WdfwSmY8

I'm using some local files on my server, which are the last 2 source images.

the error I'm getting is:

[15-Nov-2017 17:24:33 UTC] PHP Fatal error: Uncaught Filestack\FilestackException: [400]: conv20 provider error: Error fetching file: 401 (idx 0) thrown in /home/stagmm/public_html/tools/filestack/filestack/mixins/CommonMixin.php on line 314

hueyl77 commented 6 years ago

hi @johncarlson21

A 401 errors means there is an authorization error. Looks like your sources http://staging2.magicmurals.com/tools/filestack/tests/testfiles/Ultimo_TopNav041816.jpg and

http://staging2.magicmurals.com/tools/filestack/tests/testfiles/Ultimo_ColorScheme-041816L.jpg

requires an auth username and password.

In order to use collage your sources have to be accessible by the code.

johncarlson21 commented 6 years ago

Yeah.. I first had the auth turned on, but then I disabled it and it wouldn't work. I'm going to give it a shot on another server and see how it goes. Thanks.

hueyl77 commented 6 years ago

Sure, please let us know how it goes.

p.s. Also make sure the destination folder exists and your code has permission to write to it. The created collage file will be downloaded to that destination when you make this call:

$collage_filelink = $client->collage($sources, 800, 600);

$destination = __DIR__ . '/tests/testfiles/collage-test.png';
$result = $collage_filelink->download($destination);

If you don't want it downloaded, you should be able to just grab the URL of the file generated on the Filestack server by calling the url() function on the result Filelink object.

$collage_filelink = $client->collage($sources, 800, 600);
$new_collage_image_url = $collage_filelink->url();
johncarlson21 commented 6 years ago

Well, I got it to work on another server, but I was getting a 400 error, which referred to security.

I didn't have security turned on, so I turned it on and then used the security and it worked.

On Thu, Nov 16, 2017 at 10:47 AM, Huey Ly notifications@github.com wrote:

Sure, please let us know how it goes.

p.s. Also make the the destination folder exists and your code has permission to write to it. The created collage file will be downloaded to that destination when you make this call:

$collage_filelink = $client->collage($sources, 800, 600);

$destination = DIR . '/tests/testfiles/collage-test.png'; $result = $collage_filelink->download($destination);

If you don't want it downloaded, you should be able to just grab the URL of the file generated on the Filestack server by calling the url() function on the result Filelink object.

$collage_filelink = $client->collage($sources, 800, 600); $new_collage_image_url = $collage_filelink->url();

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/filestack/filestack-php/issues/31#issuecomment-344984567, or mute the thread https://github.com/notifications/unsubscribe-auth/AABlJat4_qxEmxB5WlW3eq9TUSoPZehgks5s3Gc_gaJpZM4QfTdG .

hueyl77 commented 6 years ago

👍

Thanks for the updates. Feel free to hit me up with questions at anytime if you run into any other issues. Cheers :)