Zend - The PHP Company




Graphics

Add Code


JPG optimizer  

Type: code fragment
Added by: matthijs_c
Entered: 19/03/2002
Last modified: 03/12/2001
Rating: - (fewer than 3 votes)
Views: 4901
Code is simple but it works, normal non optimized jpegs will become small and fast loading site friendly jpegs. note: can be used with gd lower than 2.x and images will remain to be clear and undistorted


<?php
function compress_jpeg($input_file$output_file) {
    
$img ImageCreateFromJPEG($input_file);
    
imageinterlace($img,1);
    
$compressed ImageJPEG($img$output_file60);
    
ImageDestroy($img);         
    return 
1;
}
?>


Usage Example




Rate This Script





Search



This Category All Categories