// Load the image $image = imagecreatefromjpeg('path/to/image.jpg'); // Get information about the image $width = imagesx($image); $height = imagesy($image); // Display the image header('Content-Type: image/jpeg'); imagejpeg($image); imagedestroy($image);
// Load the image $image = new Imagick('path/to/image.jpg'); // Resize the image $image->resizeImage(800, 600, Imagick::FILTER_LANCZOS, 1); // Display the image header('Content-Type: image/jpeg'); echo $image; $image->destroy();This code loads a JPEG image using Imagick's `new Imagick()` constructor and then resizes it using the `resizeImage()` method. Finally, it sends the modified image to the browser using `echo` and destroys the image object.