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
337           elseif ( 'image/png' == $mime_type ) {
338                // convert from full colors to index colors, like original PNG.
339                if ( function_exists('imageistruecolor') && ! imageistruecolor( $image ) )
340                     imagetruecolortopalette( $image, false, imagecolorstotal( $image ) );
341
342                if ( ! $this->make_image( $filename, 'imagepng', array( $image, $filename ) ) )
343                     return new WP_Error( 'image_save_error', __('Image Editor Save Failed') );
344           }
345           elseif ( 'image/jpeg' == $mime_type ) {
346                if ( ! $this->make_image( $filename, 'imagejpeg', array( $image, $filename, apply_filters( 'jpeg_quality', $this->quality, 'image_resize' ) ) ) )
347                     return new WP_Error( 'image_save_error', __('Image Editor Save Failed') );
348           }
349           else {
350                return new WP_Error( 'image_save_error', __('Image Editor Save Failed') );
351           }
352
353           // Set correct file permissions
354           $stat = stat( dirname( $filename ) );
355           $perms = $stat['mode'] & 0000666; //same permissions as parent folder, strip off the executable bits