Page 1 of 1

Using scripts with Amazon Cloudfront

Posted: 2016-03-04T08:02:35-07:00
by odd_duck
I'm testing out Fred's cyclinderize script and it works fine on my server.

Now the problem is on my website: The majority of my images are dynamically created/sized (with php imagick) and are delivered on Amazon Cloudfront. See this link for full info:

http://www.sitepoint.com/dynamic-image- ... udfront-2/

So my images instead of being called like:

Code: Select all

<img src="http://www.mywebsite.com/minD_80/imagestore/Penguins.jpg" alt="" />
They are instead like so:

Code: Select all

<img src="//abcdefg1234.cloudfront.net/minD_80/imagestore/Penguins.jpg" alt="" />

So my setup is the below in my cylinder.php script:

Code: Select all

$docRoot = getenv("DOCUMENT_ROOT");
header("Content-type: image/jpeg");
passthru("bash ".$docRoot."/path-to/cylinderize.sh -m vertical -r 132 -l 270 -w 100 -p 13 -d down -e 1.4 -a 95 -v background -b none -f none -o +0+8 -n 93 front.jpg back.png JPG:-");
And in an HTML file i have:

Code: Select all

<img src="cylinder.php" />
All ok. Now if i try and use Cloudfront it doesn't work:

Code: Select all

<img src="//abcdefg1234.cloudfront.net/cylinder.php" />
I'm guessing it's because the bash script isn't installed on Amazon? Is there a way to do so?

Re: Using scripts with Amazon Cloudfront

Posted: 2016-03-04T10:21:22-07:00
by fmw42
I think you are correct and I do not know if you can install the script on Amazon. But, you should be able to download the image from Amazon to your own server, then process it, then upload back to Amazon.

Re: Using scripts with Amazon Cloudfront

Posted: 2016-10-07T01:08:42-07:00
by odd_duck
Thanks. Is it possible to have the script on my server but use images off my amazon s3 (i have tried putting the image src as a file off my s3 bucket - it doesn't work but just incase i'm missing anything?)

Or does the image itself also have to reside on my server?

Re: Using scripts with Amazon Cloudfront

Posted: 2016-10-07T09:41:00-07:00
by fmw42
I have never used an image from another server in my scripts. So I do not really know.

You may need to first use Imagemagick to access the file and convert it to a file on your server independent of the script. Then use the script to access the new file on your server.