Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $result = move_uploaded_file($tmpName, $filePath);
- $orig_image = imagecreatefromjpeg($filePath);
- $image_info = getimagesize($filePath);
- $width_orig = $image_info[0]; // current width as found in image file
- $height_orig = $image_info[1]; // current height as found in image file
- $width = 1024; // new image width
- $height = 768; // new image height
- $destination_image = imagecreatetruecolor($width, $height);
- imagecopyresampled($destination_image, $orig_image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig);
- // This will just copy the new image over the original at the same filePath.
- imagejpeg($destination_image, $filePath, 100);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement