How to Resize & Crop an Image Array with PHP
<pre><code>&lt;?php
$images = glob('../images_/*.{gif,png,jpg,jpeg}', GLOB_BRACE); //formats to look for

$num_of_files = 6; //number of images to display

foreach($images as $image)
{
    $num_of_files--;

    if($num_of_files &gt; -1) //this made me laugh when I wrote it
        echo "&lt;b&gt;".$image."&lt;/b&gt;&lt;br&gt;Created on ".date('D, d M y H:i:s', filemtime($image)) ."&lt;br&gt;&lt;img src="."'".$image."'"." width='100px'/&gt;&lt;br&gt;&lt;br&gt;" ; //display images
    else
        break;
}




$dst_x = 0;
$dst_y = 0;
$src_x = 250; // Crop Start X
$src_y = 250; // Crop Srart Y
$dst_w = 113; // Thumb width
$dst_h = 82; // Thumb height
$src_w = 160; // $src_x + $dst_w
$src_h = 120; // $src_y + $dst_h

$dst_image = imagecreatetruecolor($dst_w,$dst_h);
$src_image = imagecreatefromjpeg($image);
imagecopyresampled($dst_image, $src_image, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h);
$myimg = imagejpeg($dst_image, "../images_/crop.jpg");

echo "&lt;img src='$filePath$myimg'  /&gt;";
?&gt;
</code></pre>

<p>I'm not sure how to add a resize &amp; crop to the image array/glob.
all the samples online deal with a directory not an array.
I'm just trying to get only 6 recent images from a directory.
The sample for croping does not give a good output.</p>

<p><a href="http://dataonpixels.com/images_/crop.jpg" rel="nofollow">cropped</a></p>

<p><a href="http://dataonpixels.com/images_/567__default.jpg" rel="nofollow">original</a></p>
