$image = imagecreatefromjpeg('image.jpg'); $width = imagesx($image); $height = imagesy($image); $new_image = imagecreatetruecolor($width, $height); imagecopyresampled($new_image, $image, 0, 0, 0, 0, $width, $height, $width, $height); imagedestroy($image);
$image = new Imagick('image.jpg'); $image->thumbnailImage(100, 100); $image->writeImage('thumbnail.jpg');This example uses the Imagick library to create a new thumbnail image by resizing an existing JPEG image. In both examples, the __construct function is not explicitly called as it is called internally when creating a new instance of the Image class.