Skip to content

Instantly share code, notes, and snippets.

View rogersautosol's full-sized avatar
💭
I may be slow to respond.

rogersautosol

💭
I may be slow to respond.
View GitHub Profile
@rogersautosol
rogersautosol / resize_image.php
Created June 15, 2020 09:42 — forked from janzikan/resize_image.php
PHP: Resize image - preserve ratio of width and height
/**
* Resize image - preserve ratio of width and height.
* @param string $sourceImage path to source JPEG image
* @param string $targetImage path to final JPEG image file
* @param int $maxWidth maximum width of final image (value 0 - width is optional)
* @param int $maxHeight maximum height of final image (value 0 - height is optional)
* @param int $quality quality of final image (0-100)
* @return bool
*/
function resizeImage($sourceImage, $targetImage, $maxWidth, $maxHeight, $quality = 80)