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