a few words about web development

Lossless JPEG Optimizer

Another straight to the point solution
The code below removes all metadata and thumbnails and saves JPEG images as baseline (or progressive). This method makes JPEG images smaller but doesn't change even a single pixel so the quality stays intact.
$url = 'http://your_server.com/image.jpg';
$data = json_decode(file_get_contents('http://api.rest7.com/v1/jpeg_optim.php?url=' . $url . '&encoding=baseline'));
//$data = json_decode(file_get_contents('http://api.rest7.com/v1/jpeg_optim.php?url=' . $url . '&encoding=progressive'));

if (@$data->success !== 1)
$image = file_get_contents($data->file);
file_put_contents('clean.jpg', $image);