

Now create the image object using the $path variable we just created: $image = imagecreatefromjpeg($path) Īdd some important headers. This will allow us to piggyback any number of formatting commands on a single image by separating each one with a comma in the URL. We’re creating an array (using explode) out of the format. Let’s start by picking up the querystring variables (format and path) being submitted by the rewrite rule we previously added to our. All of the following code snippets go right in the image.php file you just created. To keep things simple we’re going to assume all of your images are jpg format.

Now we’re talking! Using “minD_80” instead of “maxD_80” results in an image that is as small as possible, but keeping the smallest side at least 80 pixels. That’s okay, but what if you want to use a square thumbnail as background image and you want to make sure wide or tall images don’t have white spaces on the edge? Easy solution: That was easy! Simply prefixing the name of the image with “maxD_80” automatically resized it down to a maximum width of 80 pixels on its longest side. With the solution I will demonstrate, all you need to do is reference following URL in your source: Using the original image obviously won’t work. You want to use that image as a thumbnail that’s 80 pixels square– what do you do? Here’s the scenario: You upload an image to your server called “Penguins.jpg” that is 1024 x 768 pixels.
AWS IMAGE RESIZE CLOUDFRONT HOW TO
I’ll show you how to put it together, but first I want to show you how you’ll use it (that’s the fun part, right?)
