What are the differences between using a file name and a directory path as parameters in PHP image manipulation functions like imagejpeg()?

When using PHP image manipulation functions like imagejpeg(), it is important to understand the difference between using a file name and a directory path as parameters. Using a file name as a parameter specifies the location and name of the output image file. On the other hand, using a directory path as a parameter specifies the location where the output image file should be saved, but the file name needs to be specified separately. To avoid any confusion, it is recommended to always use a file name as a parameter when calling image manipulation functions.

// Example of using a file name as a parameter in imagejpeg()
$image = imagecreatefromjpeg('input.jpg');
imagejpeg($image, 'output.jpg');
imagedestroy($image);