I'm not sure whether or not this function does what I intend it to do, but what I need is to create a thumbnail of an image in the folder.
$filename = '../images/' . $new_name;
header('Content-Type: image/jpeg');
list($width, $height) = getimagesize($filename);
$new_width = $width / $height;
$new_height = 250 / $new_width;
$new_height = round($new_height);
$image_p = imagecreatetruecolor(250, $new_height);
$image_s = imagecreatefromjpeg($filename);
imagecopyresampled($image_p, $image_s, 0, 0, 0, 0, 250, $new_height, $width, $height);
imagejpeg($image_p, null, 100);
So I need to save the final result to my folder, but not overwrite the original image. I found this function on the http://php.net/, but I have no idea as to how to save the image.
imagejpeg($image_p, "path/to/dir/image.jpg", 100);
And that is all.