Code:
<?php
header('Content-type: image/jpeg');
$filename = 'http://www.yoursite.com/images/cowboybebop27.JPG';
$image = imagecreatefromjpeg($filename);
$dest='temp_image.jpg';
imagejpeg($image, null, 10);
imagejpeg($image, $dest, 10);
?>
The above code will pull an image and save it at the file location of temp_image.jpg.
Code:
imagejpeg($image, null, 10); //This line displays the image with a quality of 10% which is roughly 1/10 the original file size as well.
Code:
imagejpeg($image, $dest, 10); //This line saves the image with an image quality of 10%.
You can read more about it here.
Bookmarks