With vanilla PHP, image manipulation can be a bit of a pain. Luckily, thanks to the Intervention/Image package, we have an easy Laravel-like way to transform images.
As an aside, please note that uploading images/photos to your
public directy implies that they may be publicly viewable. If you want them to be private, save them outside of this directory and use filters to determine access levels.