Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: jpeg_quality

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
355           elseif ( 'image/png' == $mime_type ) {
356                // convert from full colors to index colors, like original PNG.
357                if ( function_exists('imageistruecolor') && ! imageistruecolor( $image ) )
358                     imagetruecolortopalette( $image, false, imagecolorstotal( $image ) );
359
360                if ( ! $this->make_image( $filename, 'imagepng', array( $image, $filename ) ) )
361                     return new WP_Error( 'image_save_error', __('Image Editor Save Failed') );
362           }
363           elseif ( 'image/jpeg' == $mime_type ) {
364                if ( ! $this->make_image( $filename, 'imagejpeg', array( $image, $filename, apply_filters( 'jpeg_quality', $this->quality, 'image_resize' ) ) ) )
365                     return new WP_Error( 'image_save_error', __('Image Editor Save Failed') );
366           }
367           else {
368                return new WP_Error( 'image_save_error', __('Image Editor Save Failed') );
369           }
370
371           // Set correct file permissions
372           $stat = stat( dirname( $filename ) );
373           $perms = $stat['mode'] & 0000666; //same permissions as parent folder, strip off the executable bits