Code
$files = scandir("images");
$exclude = array(".", "..");
$images = array_diff($files, $exclude);
foreach($images as $image) {
$original_image = imagecreatefromjpeg("images/{$image}");
$original_width = imagesx($original_image);
$original_height = imagesy($original_image);
$new_width = 180;
$new_height = floor($original_height * ($new_width/$original_width));
$new_image = imagecreatetruecolor($new_width, $new_height);
imagecopyresampled($new_image, $original_image, 0, 0, 0, 0, $new_width, $new_height, $original_width, $original_height);
header("Content-Type: image/jpeg");
imagejpeg($new_image);
}
Problem
The resizing part of the code works just fine, but it only outputs the first resized image. How can I make it so that it dumps all of the resized images?