I would like manipulate/resize images in a similar way to Pinterest but I am not sure what is the best way to approach it. The goal is to allow a mix of both portrait and la
You just need to understand which of the two edges of the image is longer, and compute the other dimension proportionally. If the maximum long-egde is 1024, then if one of the two edges is larger you will set that to 1024, and compute the other to fit the proportions. Then you will pass those two values to your image management functions.
Like here: http://www.white-hat-web-design.co.uk/blog/resizing-images-with-php/
Or here: http://www.9lessons.info/2009/03/upload-and-resize-image-with-php.html