Use PHP to crop an image from another website on the same server
I need to resize and crop some images that I'm sticking into FPDF... I need them to be resized and cropped to fit a 150 x 188 pixel rectangle... but I'd prefer to have a reusable function that I can pass the filename (full URL) and the target-dimensions to... then I can have it do the math with the dimensions to find out how big the resized image should be... I just need it to actually make a copy that size and then crop it to the other dimensions (evenly cropped, please, so it's still centered)
Any help is greatly appreciated. I've seen tons of ideas around the internet that just don't work and it's hard to sift through and find one that actually does.
And it needs to work with a full URL because most of the images are on a different website, but they're all hosted on the same server & account.