I came up with this:
<?php
$dir = $_GET['dir'];
header('Content-type: image/jpeg');
$create = imagecreatetruecolor(150, 150);
$img = imagecreatefromjpeg($dir);
imagecopyresampled($create, $img, 0, 0, 0, 0, 150, 150, 150, 150);
imagejpeg($create, null, 100);
?>
It works by accessing:
Which works fine... but the output is awful:
Can someone fix my code for the image to be 150 x 150 covering the black area...
Thanks.
SOLUTION:
<?php
$dir = $_GET['dir'];
header('Content-type: image/jpeg');
list($width, $height) = getimagesize($dir);
$create = imagecreatetruecolor(150, 150);
$img = imagecreatefromjpeg($dir);
$newwidth = 150;
$newheight = 150;
imagecopyresized($create, $img, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
imagejpeg($create, null, 100);
?>