Using scripts with Amazon Cloudfront

A plethora of command-line scripts that perform geometric transforms, blurs, sharpens, edging, noise removal, and color manipulations.
Post Reply
odd_duck
Posts: 8
Joined: 2016-02-19T03:28:23-07:00
Authentication code: 1151

Using scripts with Amazon Cloudfront

Post by odd_duck » 2016-03-04T08:02:35-07:00

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?

User avatar
fmw42
Posts: 22079
Joined: 2007-07-02T17:14:51-07:00
Location: Sunnyvale, California, USA

Re: Using scripts with Amazon Cloudfront

Post by fmw42 » 2016-03-04T10:21:22-07:00

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.

odd_duck
Posts: 8
Joined: 2016-02-19T03:28:23-07:00
Authentication code: 1151

Re: Using scripts with Amazon Cloudfront

Post by odd_duck » 2016-10-07T01:08:42-07:00

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?

User avatar
fmw42
Posts: 22079
Joined: 2007-07-02T17:14:51-07:00
Location: Sunnyvale, California, USA

Re: Using scripts with Amazon Cloudfront

Post by fmw42 » 2016-10-07T09:41:00-07:00

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.

Post Reply