slj90 Posted November 26, 2015 Share Posted November 26, 2015 I am using the following code to save an image if($_SERVER['REQUEST_METHOD'] == "POST") { // location to save cropped image $url = 'saved12223.jpg'; // remove the base64 part $base64 = base64_decode(preg_replace('#^data:image/[^;]+;base64,#', '', $_POST['string'])); // create image $source = imagecreatefromstring($base64); // save image imagejpeg($source, $url, 100); } But how can I resize the width and height before saving the image. I'm not sure if I should be resizing the source or the string? Please could someone point me in the right direction. Thanks, Quote Link to comment https://forums.phpfreaks.com/topic/299589-resize-image/ Share on other sites More sharing options...
maxxd Posted February 4, 2016 Share Posted February 4, 2016 Not sure why you'd recommend C# code instead of php in this case, but sure. PHP does have imagecopyresized() and imagecopyresampled() functions that should do what the OP is looking for. Quote Link to comment https://forums.phpfreaks.com/topic/299589-resize-image/#findComment-1530759 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.